DHT Family of Humidity and Temperature Sensors¶
Device driver for the DHT Family of humidity and temperature sensors.
This driver provides [S]ensor [A]ctuator [U]ber [L]ayer capabilities.
-
enum
@117¶ - DHT_OK
= 0 - all good
- DHT_NOCSUM
= -1 - checksum error
- DHT_NODEV
= -2 - device type not defined
- DHT_OK
-
enum
dht_type_t¶ - DHT11
- DHT11 device identifier.
- DHT22
- DHT22 device identifier.
- DHT21
= DHT22 - DHT21 device identifier.
-
int
dht_init(dht_t * dev, constdht.h::dht_params_t* params)¶ Initialize a new DHT device.
Parameters
dev: device descriptor of a DHT device params: configuration parameters Return values
- 0 on success
- -1 on error
-
int
dht_read(const 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
dev: device descriptor of a DHT device temp: temperature value [in °C * 10^-1] hum: relative humidity value [in percent * 10^-1] Return values
- 0 on success
- -1 on checksum error
- -2 on parsing error
-
struct
dht_data_t¶ Data type for storing DHT sensor readings.
-
uint16_t
humidity¶ relative deca-humidity
-
uint16_t
temperature¶ temperature in deca-Celsius
-
uint16_t
-
struct
dht_t¶ Device descriptor for DHT sensor devices.
-
gpio.h::gpio_tpin¶ GPIO pin of the device’s data pin.
-
dht.h::dht_type_ttype¶ type of the DHT device
-
cc2538/include/periph_cpu.h::gpio_mode_tin_mode¶ input pin configuration, with or without pull resistor
-