Driver for the Sensirion SHTCX sensor.
More...
Driver for the Sensirion SHTCX sensor.
|
file | shtcx.h |
| Device driver interface for the SHTCX Temperature and humidity sensor.
|
|
file | shtcx_params.h |
| Default parameters for the SHTCX Temperature and humidity sensor.
|
|
file | shtcx_regs.h |
| Register definitions for SHTCX devices.
|
|
◆ SHTCX_I2C_ADDRESS
#define SHTCX_I2C_ADDRESS (0x70) |
SHTCX Default Address.
Definition at line 41 of file shtcx.h.
◆ anonymous enum
Enumerator |
---|
SHTCX_OK | Success, no error.
|
SHTCX_ERROR_BUS | I2C bus error.
|
SHTCX_ERROR_CRC | CRC error.
|
SHTCX_ERROR | General error.
|
Definition at line 63 of file shtcx.h.
◆ shtcx_id()
int8_t shtcx_id |
( |
const shtcx_t * |
dev, |
|
|
uint16_t * |
id |
|
) |
| |
Reads the ID and saves it in the device descriptor.
When working correctly ID should equal xxxx'xxxx'xx00'0111 where x is unspecified.
- Parameters
-
[in] | dev | The I2C device descriptor. |
[in] | id | ID of the device. |
- Returns
- SHTCX_OK on everything done.
-
SHTCX_ERROR_BUS on error.
◆ shtcx_init()
Initializes the sensor and I2C.
- Parameters
-
[in] | dev | I2C device descriptor. |
[in] | params | SHTCX parameters to be used. |
- Returns
- SHTCX_OK on a working initialization.
-
SHTCX_ERROR_BUS Reading I2C failed.
-
SHTCX_ERROR_CRC Wrong ID.
◆ shtcx_read()
int8_t shtcx_read |
( |
const shtcx_t * |
dev, |
|
|
uint16_t * |
rel_humidity, |
|
|
int16_t * |
temperature |
|
) |
| |
Reads all register values from the device.
The values as raw data will be saved into received.
- Parameters
-
[in] | dev | The I2C device descriptor. |
[in] | rel_humidity | Humidity in centi %. |
[in] | temperature | Temperature in centi °C. |
- Returns
- SHTCX_OK if a measurement completed.
-
SHTCX_ERROR_BUS reading I2C failed.
-
SHTCX_ERROR_CRC on checksum error.
◆ shtcx_reset()
int8_t shtcx_reset |
( |
const shtcx_t * |
dev | ) |
|
Resets sensor.
This will reset all internal state machines and reload calibration data from the memory.
- Parameters
-
[in] | dev | The I2C device descriptor. |
- Returns
- SHTCX_OK on everything done.
-
SHTCX_ERROR_BUS on error.