Device driver for the DHT Family of humidity and temperature sensors.
More...
Device driver for the DHT Family of humidity and temperature sensors.
This driver provides [S]ensor [A]ctuator [U]ber [L]ayer capabilities.
|
| file | dht_params.h |
| | Default configuration for DHT devices.
|
| |
| file | dht.h |
| | Device driver interface for the DHT family of humidity and temperature sensors.
|
| |
◆ dht_type_t
Device type of the DHT device.
| Enumerator |
|---|
| DHT11 | Older DHT11 variants with either 1 °C or 0.1 °C resolution.
|
| DHT11_2022 | New DHT11 variant with 0.01 °C resolution.
|
| DHT22 | DHT22 device identifier.
|
| DHT21 | DHT21 device identifier.
|
| AM2301 | AM2301 device identifier.
|
Definition at line 53 of file dht.h.
◆ dht_init()
Initialize a new DHT device.
- Parameters
-
| [out] | dev | device descriptor of a DHT device |
| [in] | params | configuration parameters |
- Return values
-
| 0 | Success |
| -EXDEV | A low level on the input after the sensor's startup time indicates that either no sensor or pull-up resistor is connected, or the sensor is physically poorly connected or powered. |
| -ENODEV | The sensor did not respond to the transmission of a start signal. Likely there were a pull-up resistor but no sensor connected on the data line. |
◆ dht_read()
| int dht_read |
( |
dht_t * |
dev, |
|
|
int16_t * |
temp, |
|
|
int16_t * |
hum |
|
) |
| |
get a new temperature and/or humidity value from the device
- Note
- if reading fails or checksum is invalid, no new values will be written into the result values
- Parameters
-
| [in] | dev | device descriptor of a DHT device |
| [out] | temp | temperature value [in °C * 10^-1], may be NULL if not needed |
| [out] | hum | relative humidity value [in percent * 10^-1], may be NULL if not needed |
- Return values
-
| 0 | Success |
| -ENODEV | The sensor did not respond to the transmission of a start signal. Likely the RESPAWN_TIMEOUT is insufficient. |
| -EIO | The received and the expected checksum didn't match. |
| -ENOSYS | Unable to parse the received data. Likely the data format is not implemented. |
| -ERANGE | Temperature low byte >= 10. Likely misconfigured device type (DHT11_2022). |