Driver for the TI HDC1000 Humidity and Temperature Sensor.
More...
Driver for the TI HDC1000 Humidity and Temperature Sensor.
The driver will initialize the sensor for best resolution (14 bit). Currently the driver doesn't use the heater. Temperature and humidity are acquired in sequence. The sensor is always in sleep mode.
The temperature and humidity values can either be acquired using the simplified hdc1000_read()
function, or the conversion can be triggered manually using the hdc1000_trigger_conversion()
and hdc1000_get_results()
functions sequentially. If using the second method, on must wait at least CONFIG_HDC1000_CONVERSION_TIME
between triggering the conversion and reading the results.
- Note
- The driver does currently not support using the devices heating unit.
This driver provides [S]ensor [A]ctuator [U]ber [L]ayer capabilities.
◆ anonymous enum
HDC1000 specific return values.
Enumerator |
---|
HDC1000_OK | everything went as expected
|
HDC1000_NODEV | no HDC1000 device found on the bus
|
HDC1000_NOBUS | errors while initializing the I2C bus
|
HDC1000_BUSERR | error during I2C communication
|
Definition at line 84 of file hdc1000.h.
◆ hdc1000_res_t
Possible resolution values.
Enumerator |
---|
HDC1000_11BIT | 11-bit conversion
|
HDC1000_14BIT | 14-bit conversion
|
Definition at line 94 of file hdc1000.h.
◆ hdc1000_get_results()
int hdc1000_get_results |
( |
const hdc1000_t * |
dev, |
|
|
int16_t * |
temp, |
|
|
int16_t * |
hum |
|
) |
| |
Read conversion results for temperature and humidity.
- Parameters
-
[in] | dev | device descriptor of sensor |
[out] | temp | temperature [in 100 * degree centigrade] |
[out] | hum | humidity [in 100 * percent relative] |
- Returns
- HDC1000_OK on success
-
HDC1000_BUSERR on I2C communication failures
◆ hdc1000_init()
Initialize the given HDC1000 device.
- Parameters
-
[out] | dev | device descriptor of sensor to initialize |
[in] | params | configuration parameters |
- Returns
- HDC1000_OK on success
-
HDC1000_NOBUS if initialization of I2C bus fails
-
HDC1000_NODEV if no HDC1000 device found on bus
◆ hdc1000_read()
int hdc1000_read |
( |
const hdc1000_t * |
dev, |
|
|
int16_t * |
temp, |
|
|
int16_t * |
hum |
|
) |
| |
Convenience function for reading temperature and humidity.
This function will trigger a new conversion, wait for the conversion to be finished and the get the results from the device.
- Parameters
-
[in] | dev | device descriptor of sensor |
[out] | temp | temperature [in 100 * degree centigrade] |
[out] | hum | humidity [in 100 * percent relative] |
- Returns
- HDC1000_OK on success
-
HDC1000_BUSERR on I2C communication failures
◆ hdc1000_read_cached()
int hdc1000_read_cached |
( |
const hdc1000_t * |
dev, |
|
|
int16_t * |
temp, |
|
|
int16_t * |
hum |
|
) |
| |
Extended read function including caching capability.
This function will return cached values if they are within the sampling period (HDC1000_PARAM_RENEW_INTERVAL), or will trigger a new conversion, wait for the conversion to be finished and the get the results from the device.
- Parameters
-
[in] | dev | device descriptor of sensor |
[out] | temp | temperature [in 100 * degree centigrade] |
[out] | hum | humidity [in 100 * percent relative] |
- Returns
- HDC1000_OK on success
-
HDC1000_BUSERR on I2C communication failures
◆ hdc1000_trigger_conversion()
int hdc1000_trigger_conversion |
( |
const hdc1000_t * |
dev | ) |
|
Trigger a new conversion.
After the conversion is triggered, one has to wait CONFIG_HDC1000_CONVERSION_TIME us until the results can be read using hdc1000_get_results().
- Parameters
-
[in] | dev | device descriptor of sensor |
- Returns
- HDC1000_OK on success
-
HDC1000_BUSERR on I2C communication failures