// Pin and port configuration for DHT11 #define DHT11_GPIO_PORT GPIOA #define DHT11_GPIO_PIN GPIO_Pin_0 #define DHT11_GPIO_RCC RCC_APB2Periph_GPIOA
// Macros for data line manipulation #define DHT11_DATA_HIGH() GPIO_SetBits(DHT11_GPIO_PORT, DHT11_GPIO_PIN) #define DHT11_DATA_LOW() GPIO_ResetBits(DHT11_GPIO_PORT, DHT11_GPIO_PIN) #define DHT11_DATA_READ() GPIO_ReadInputDataBit(DHT11_GPIO_PORT, DHT11_GPIO_PIN)
// Data structure for storing humidity and temperature readings typedefstruct { uint8_t humi_int; // Integer part of humidity uint8_t humi_deci; // Decimal part of humidity uint8_t temp_int; // Integer part of temperature uint8_t temp_deci; // Decimal part of temperature uint8_t check_sum; // Checksum for data integrity } DHT11_Data_TypeDef;
// Function prototypes voidDHT11_Init(void); uint8_tDHT11_ReadData(DHT11_Data_TypeDef *pData);