Device Driver for Sensirion SHT30/SHT31/SHT35 Humidity and Temperature Sensors. More...
Device Driver for Sensirion SHT30/SHT31/SHT35 Humidity and Temperature Sensors.
Definition in file sht3x.h.
Go to the source code of this file.
Data Structures | |
struct | sht3x_params_t |
SHT3x device initialization parameters. More... | |
struct | sht3x_dev_t |
SHT3x sensor device data structure. More... | |
#define | SHT3X_I2C_ADDR_1 (0x44) |
possible I2C slave addresses | |
#define | SHT3X_I2C_ADDR_2 (0x45) |
ADDR pin connected to VDD. | |
enum | sht3x_error_codes { SHT3X_OK , SHT3X_ERROR_I2C , SHT3X_ERROR_CRC , SHT3X_ERROR_STATUS , SHT3X_ERROR_MEASURE_CMD_INV } |
Driver error codes (returned as negative values) More... | |
enum | sht3x_mode_t { SHT3X_SINGLE_SHOT = 0 , SHT3X_PERIODIC_0_5_MPS , SHT3X_PERIODIC_1_MPS , SHT3X_PERIODIC_2_MPS , SHT3X_PERIODIC_4_MPS , SHT3X_PERIODIC_10_MPS } |
SHT3x measurement modes. More... | |
enum | sht3x_repeat_t { SHT3X_HIGH = 0 , SHT3X_MEDIUM , SHT3X_LOW } |
SHT3x repeatability levels. More... | |
int | sht3x_init (sht3x_dev_t *dev, const sht3x_params_t *params) |
Initialize the SHT3x sensor device. | |
int | sht3x_read (sht3x_dev_t *dev, int16_t *temp, int16_t *hum) |
Read SHT3x measurement results (temperature and humidity) | |
#define SHT3X_I2C_ADDR_1 (0x44) |
enum sht3x_error_codes |
enum sht3x_mode_t |
SHT3x measurement modes.
enum sht3x_repeat_t |
SHT3x repeatability levels.
The stated repeatability is 3 times the standard deviation of multiple consecutive measurements at the stated repeatability and at constant ambient conditions. It is a measure for the noise on the physical sensor output. Different measurement modes allow for high/medium/low repeatability. [Datasheet SHT3x-DIS]
The configured repeatability level determines the time required for a measurement:
Reapeatability | T typ. | RH typ. | Maximum Measurement Duration |
---|---|---|---|
high | 0.04 | 0.08 | 15.5 ms |
medium | 0.08 | 0.15 | 6.5 ms |
low | 0.15 | 0.21 | 4.5 ms |
Enumerator | |
---|---|
SHT3X_HIGH | high repeatability |
SHT3X_MEDIUM | medium repeatability |
SHT3X_LOW | low repeatability |
int sht3x_init | ( | sht3x_dev_t * | dev, |
const sht3x_params_t * | params | ||
) |
Initialize the SHT3x sensor device.
This function initializes the sensor device.
If the sensor device is configured in any periodic measurement mode, it immediately starts the periodic measurement with configured measurement period and configured repeatability.
In single-shot mode, the sensor device goes into the sleep mode to save power. The single measurement is started when sht3x_read is called.
[in] | dev | Device descriptor of SHT3x device to be initialized |
[in] | params | SHT3x initialization parameters |
int sht3x_read | ( | sht3x_dev_t * | dev, |
int16_t * | temp, | ||
int16_t * | hum | ||
) |
Read SHT3x measurement results (temperature and humidity)
The function returns the results of one measurement once they are available.
If the single-shot measurement mode is configured, the function
In the periodic measurement modes, the function returns the results of the last periodic measurement, if already available.
For either temp
or hum
also NULL
can be passed, if only one value is of interest.
[in] | dev | Device descriptor of SHT3x device to read from |
[out] | temp | Temperature in hundredths of a degree Celsius |
[out] | hum | Relative Humidity in hundredths of a percent |