DHT11 Driver for STM32XXX Microcontrollers to retrieve data(Temperature, Humidity) from DHT11. This library also supports error handling and temperature conversion between Celcius and Fahrenheit.
Important
Specify the HAL include files in "DHT11.h"
- STM32XXXX_HAL_HEADER_FILE
- STM32XXXX_HAL_TIM_HEAEDER_FILE for your Microcontroller.
Important
Intialize a Timer to count "1us".
-
DHT11_StatusTypeDef
- DHT11_OK
- DHT11_TIMEOUT
- DHT11_ERROR
- DHT11_CHECKSUM_MISMATCH
-
DHT11_InitTypeDef
- Temperature
- Humidity
- Status
- HAL_DHT11_Init
- HAL_DHT11_DeInit
- HAL_DHT11_GetErrorMsg
- HAL_DHT11_ReadData
- HAL_DHT11_ReadTemperatureC
- HAL_DHT11_ReadTemperatureF
- HAL_DHT11_ReadHumidity
Copy the "/Inc" & "/Src" directory into your STM32 project.
Use function HAL_DHT11_Init
& HAL_DHT11_DeInit
to handle Initalization and DeInitialization.
Intitalizes the DHT11 Driver.
-
Arguments:
DHT11
instance of a DHT11 driver.GPIOx
where x can be (A..G) to select the GPIO peripheral for STM32xxxx family.GPIO_Pin
specifies the pin DHT11 is connected.TIM
handler for timer with frequency to count 1us.
-
Returns:
- None
De-initializes the DHT11 Driver.
-
Arguments:
DHT11
instance of a DHT11 driver.
-
Returns:
- None
To Read data from the DHT11, this driver provides function like HAL_DHT11_ReadData
, HAL_DHT11_ReadTemperatureC
, HAL_DHT11_ReadTemperatureF
& HAL_DHT11_ReadHumidity
Reads data(Temperature, Humidity) from the DHT11 Driver.
-
Arguments:
DHT11
instance of a DHT11 driver.
-
Returns:
Status
of the command.
Reads Temperature value in Celcius from the DHT11 Driver. Status of the command is stored in DHT11_InitTypeDef->Status.
-
Arguments:
DHT11
instance of a DHT11 driver.
-
Returns:
Temperature
in Celcius.
Reads Temperature value in Fahrenheit from the DHT11 Driver. Status of the command is stored in DHT11_InitTypeDef->Status.
-
Arguments:
DHT11
instance of a DHT11 driver.
-
Returns:
Temperature
in Fahrenheit.
Reads Humidity value from the DHT11 Driver. Status of the command is stored in DHT11_InitTypeDef->Status.
-
Arguments:
DHT11
instance of a DHT11 driver.
-
Returns:
Humidity
To get the messgaes related to Status of DHT11
driver have HAL_DHT11_GetErrorMsg
function. After every command, DHT11
driver stores the Status code in Status
instance member of the DHT11_InitTypeDef
struct.
-
Arguments:
Status
status code.
-
Returns:
Message
status message.
v1.0.1