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.
|
|
◆ anonymous enum
Possible return codes.
Enumerator |
---|
DHT_OK | all good
|
DHT_NOCSUM | checksum error
|
DHT_TIMEOUT | communication timed out
|
DHT_NODEV | device type not defined
|
Definition at line 45 of file dht.h.
◆ dht_type_t
Device type of the DHT device.
Enumerator |
---|
DHT11 | DHT11 device identifier.
|
DHT22 | DHT22 device identifier.
|
DHT21 | DHT21 device identifier.
|
Definition at line 63 of file dht.h.
◆ dht_init()
Initialize a new DHT device.
- Parameters
-
[out] | dev | device descriptor of a DHT device |
[in] | params | configuration parameters |
- Returns
- 0 on success
-
-1 on error
◆ dht_read()
int dht_read |
( |
dht_t * |
dev, |
|
|
int16_t * |
temp, |
|
|
int16_t * |
hum |
|
) |
| |
get a new temperature and 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] |
[out] | hum | relative humidity value [in percent * 10^-1] |
- Return values
-
DHT_OK | Success |
DHT_NOCSUM | Checksum error |
DHT_TIMEOUT | Reading data timed out (check wires!) |
DHT_NODEV | Unsupported device type specified |