Device driver interface for the SHTC1 Temperature and humidity sensor.
More...
#include <stdint.h>
#include "saul.h"
#include "periph/i2c.h"
Go to the source code of this file.
◆ SHTC1_I2C_ADDRESS
#define SHTC1_I2C_ADDRESS (0x70) |
SHTC1 Default Address.
Definition at line 39 of file shtc1.h.
◆ anonymous enum
Enumerator |
---|
SHTC1_OK | Success, no error.
|
SHTC1_ERROR_BUS | I2C bus error.
|
SHTC1_ERROR_CRC | CRC error.
|
SHTC1_ERROR | General error.
|
Definition at line 61 of file shtc1.h.
◆ shtc1_id()
int8_t shtc1_id |
( |
const shtc1_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
- SHTC1_OK on everything done.
-
SHTC1_ERROR_BUS on error.
◆ shtc1_init()
Initializes the sensor and I2C.
- Parameters
-
[in] | dev | I2C device descriptor. |
[in] | params | SHTC1 parameters to be used. |
- Returns
- SHTC1_OK on a working initialization.
-
SHTC1_ERROR_BUS Reading I2C failed.
-
SHTC1_ERROR_CRC Wrong ID.
◆ shtc1_read()
int8_t shtc1_read |
( |
const shtc1_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 reveived.
- Parameters
-
[in] | dev | The I2C device descriptor. |
[in] | rel_humidity | Humidity in centi %. |
[in] | temperature | Temperature in centi °C. |
- Returns
- SHTC1_OK if a measurement completed.
-
SHTC1_ERROR_BUS reading I2C failed.
-
SHTC1_ERROR_CRC on checksum error.
◆ shtc1_reset()
int8_t shtc1_reset |
( |
const shtc1_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
- SHTC1_OK on everything done.
-
SHTC1_ERROR_BUS on error.