define MAX6675_CS_Pin GPIO_PIN_12define MAX6675_CS_GPIO_Port GPIOBSPI_HandleTypeDef hspi2; / USER CODE BEGIN Includes / / USER CODE END Includes / / Private typedef -----------------------------------------------------------/ / USER CODE BEGIN TD / / USER CODE END TD / / Private define ------------------------------------------------------------/ / USER CODE BEGIN Define / / USER CODE END Define / / Private macro -------------------------------------------------------------/ / USER CODE BEGIN Macro / / USER CODE END Macro / / Private variables ---------------------------------------------------------/ / USER CODE BEGIN PV / / USER CODE END PV / / Private function prototypes -----------------------------------------------/ / USER CODE BEGIN PFP / / USER CODE END PFP / / External functions --------------------------------------------------------/ / USER CODE BEGIN ExternalFunctions / / USER CODE END ExternalFunctions / / USER CODE BEGIN 0 / /**
/ USER CODE BEGIN SPI2_Init 0 / / USER CODE END SPI2_Init 0 / / USER CODE BEGIN SPI2_Init 1 / / USER CODE END SPI2_Init 1 / / SPI2 parameter configuration/ hspi2.Instance = SPI2; hspi2.Init.Mode = SPI_MODE_MASTER; hspi2.Init.Direction = SPI_DIRECTION_2LINES; hspi2.Init.DataSize = SPI_DATASIZE_8BIT; hspi2.Init.CLKPolarity = SPI_POLARITY_LOW; hspi2.Init.CLKPhase = SPI_PHASE_1EDGE; hspi2.Init.NSS = SPI_NSS_SOFT; hspi2.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_2; hspi2.Init.FirstBit = SPI_FIRSTBIT_MSB; hspi2.Init.TIMode = SPI_TIMODE_DISABLE; hspi2.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE; hspi2.Init.CRCPolynomial = 7; hspi2.Init.CRCLength = SPI_CRC_LENGTH_DATASIZE; hspi2.Init.NSSPMode = SPI_NSS_PULSE_ENABLE; if (HAL_SPI_Init(&hspi2) != HAL_OK) { Error_Handler(); } } / USER CODE END 0 / void HAL_MspInit(void) { / USER CODE BEGIN MspInit 0 / / USER CODE END MspInit 0 / HAL_RCC_SYSCFG_CLK_ENABLE(); HAL_RCC_PWR_CLK_ENABLE(); / System interrupt init/ / USER CODE BEGIN MspInit 1 / / USER CODE END MspInit 1 / } /**
} /**
} / USER CODE BEGIN 1 / //MAX6675 片选引脚初始化 void GPIO_Init(void) { GPIO_InitTypeDef GPIO_InitStruct = {0}; / GPIO Ports Clock Enable / __HAL_RCC_GPIOB_CLK_ENABLE(); HAL_GPIO_WritePin(GPIOB, MAX6675_CS_Pin, GPIO_PIN_SET); /引脚配置 / GPIO_InitStruct.Pin = MAX6675_CS_Pin; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); } /**
/**
/**
if (tmp & 4) { // thermocouple open tmp = 4095; //未检测到热电偶 } else { tmp = tmp >> 3; } tmp=tmp&0x0FFF; //12bit return tmp; } /**
//MAX6675 片选控制 void MAX6675_CS(unsigned char choose) { if(choose == 1) { HAL_GPIO_WritePin(GPIOB, MAX6675_CS_Pin, GPIO_PIN_SET); } else { HAL_GPIO_WritePin(GPIOB, MAX6675_CS_Pin, GPIO_PIN_RESET); } } |
Stlcr1v1传感器的连接座是通过哪几个引脚往外传温度的啊?
stm32f103vct6的dac输出电压不是线性的,而且过一段时间会小幅度变化?
LSM6DS3TR-C数据读取异常
在OLED初始化之后(SPI方式)的所有模块都不能成功初始化,DHT11放在OLED初始化之前能成功初始,但放在后面就初始化失败。
STM32G0系列内部温度传感器
传感器是什么?
大神帮帮忙,这个料号是?
请问下,谁能推荐个高精度的温度传感器,还有光传感器
SHT3X温湿度传感器程序,stm32系列标准库