sht3x.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Gunar Schorcht
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
17 #ifndef SHT3X_H
18 #define SHT3X_H
19 
20 #include <stdint.h>
21 #include <stdbool.h>
22 
23 #include "periph/i2c.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
30 #define SHT3X_I2C_ADDR_1 (0x44)
31 #define SHT3X_I2C_ADDR_2 (0x45)
36 typedef enum {
43 
47 typedef enum {
54 } sht3x_mode_t;
55 
56 
75 typedef enum {
76  SHT3X_HIGH = 0,
80 
81 
85 typedef struct {
87  uint8_t i2c_addr;
91 
95 typedef struct {
96 
98  uint8_t i2c_addr;
104  uint32_t meas_start_time;
105  uint32_t meas_duration;
107 } sht3x_dev_t;
108 
109 
127 int sht3x_init (sht3x_dev_t *dev, const sht3x_params_t *params);
128 
163 int sht3x_read (sht3x_dev_t* dev, int16_t* temp, int16_t* hum);
164 
165 #ifdef __cplusplus
166 }
167 #endif
168 
169 #endif /* SHT3X_H */
170 
sht3x_mode_t mode
measurement mode used
Definition: sht3x.h:88
medium repeatability
Definition: sht3x.h:77
bool meas_started
indicates whether measurement is started
Definition: sht3x.h:103
no error
Definition: sht3x.h:37
low repeatability
Definition: sht3x.h:78
unsigned int i2c_t
Default i2c_t type definition.
Definition: i2c.h:151
sht3x_repeat_t repeat
repeatability level used
Definition: sht3x.h:101
int sht3x_init(sht3x_dev_t *dev, const sht3x_params_t *params)
Initialize the SHT3x sensor device.
sht3x_mode_t mode
measurement mode used
Definition: sht3x.h:100
sht3x_repeat_t repeat
repeatability level used
Definition: sht3x.h:89
uint8_t i2c_addr
I2C address.
Definition: sht3x.h:98
sht3x_repeat_t
SHT3x repeatability levels.
Definition: sht3x.h:75
high repeatability
Definition: sht3x.h:76
I2C communication failure.
Definition: sht3x.h:38
SHT3x sensor device data structure.
Definition: sht3x.h:95
measurement command not executed
Definition: sht3x.h:41
CRC check failed.
Definition: sht3x.h:39
periodic with 0.5 measurements per second (mps)
Definition: sht3x.h:49
uint32_t meas_duration
time in us until the results of the current measurement become available
Definition: sht3x.h:105
uint8_t i2c_addr
I2C address.
Definition: sht3x.h:87
i2c_t i2c_dev
I2C device.
Definition: sht3x.h:86
sht3x_mode_t
SHT3x measurement modes.
Definition: sht3x.h:47
sht3x_error_codes
Driver error codes (returned as negative values)
Definition: sht3x.h:36
periodic with 4 measurements per second (mps)
Definition: sht3x.h:52
uint32_t meas_start_time
start time of current measurement in us
Definition: sht3x.h:104
SHT3x device initialization parameters.
Definition: sht3x.h:85
single shot measurement
Definition: sht3x.h:48
periodic with 2 measurements per second (mps)
Definition: sht3x.h:51
int sht3x_read(sht3x_dev_t *dev, int16_t *temp, int16_t *hum)
Read SHT3x measurement results (temperature and humidity)
periodic with 10 measurements per second (mps)
Definition: sht3x.h:53
sensor has wrong status
Definition: sht3x.h:40
i2c_t i2c_dev
I2C device.
Definition: sht3x.h:97
periodic with 1 measurements per second (mps)
Definition: sht3x.h:50
Low-level I2C peripheral driver interface definition.