sht1x.h
Go to the documentation of this file.
1 /*
2  * Copyright 2009 Freie Universitaet Berlin (FUB)
3  * 2018 Otto-von-Guericke-Universität Magdeburg
4  *
5  * This file is subject to the terms and conditions of the GNU Lesser
6  * General Public License v2.1. See the file LICENSE in the top level
7  * directory for more details.
8  */
9 
10 #pragma once
11 
25 #include <stdint.h>
26 #include <periph/gpio.h>
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
37 typedef enum {
46 } sht1x_conf_t;
47 
51 typedef enum {
52  SHT1X_VDD_5_0V = 0,
53  SHT1X_VDD_4_0V = 1,
54  SHT1X_VDD_3_5V = 2,
55  SHT1X_VDD_3_0V = 3,
56  SHT1X_VDD_2_5V = 4,
57 } sht1x_vdd_t;
58 
62 typedef struct {
63  gpio_t clk;
64  gpio_t data;
65  int16_t temp_off;
66  int16_t hum_off;
67  uint8_t conf;
68  uint8_t vdd;
69 } sht1x_dev_t;
70 
74 typedef struct {
75  gpio_t clk;
76  gpio_t data;
79 
90 int sht1x_init(sht1x_dev_t *dev, const sht1x_params_t *params);
91 
102 int16_t sht1x_temperature(const sht1x_dev_t *dev, uint16_t raw);
103 
116 int16_t sht1x_humidity(const sht1x_dev_t *dev, uint16_t raw, int16_t temp);
117 
138 int sht1x_read(const sht1x_dev_t *dev, int16_t *temp, int16_t *hum);
139 
154 
167 int sht1x_read_status(sht1x_dev_t *dev, uint8_t *status);
168 
180 
181 #ifdef __cplusplus
182 }
183 #endif
184 
Low-level GPIO peripheral driver interface definitions.
int sht1x_init(sht1x_dev_t *dev, const sht1x_params_t *params)
Initialize the SHT10/11/15 sensor.
int16_t sht1x_humidity(const sht1x_dev_t *dev, uint16_t raw, int16_t temp)
Calculate the relative humidity from the raw input.
int sht1x_configure(sht1x_dev_t *dev, sht1x_conf_t conf)
Apply the given configuration (= status byte) to.
int sht1x_read(const sht1x_dev_t *dev, int16_t *temp, int16_t *hum)
Read the current temperature.
int16_t sht1x_temperature(const sht1x_dev_t *dev, uint16_t raw)
Calculate the temperature from the raw input.
int sht1x_read_status(sht1x_dev_t *dev, uint8_t *status)
Read the status byte of an SHT1X sensor.
sht1x_conf_t
Possible configuration (=status byte) values of the SHT10/11/15.
Definition: sht1x.h:37
int sht1x_reset(sht1x_dev_t *dev)
Reset the sensor's configuration to default values.
sht1x_vdd_t
Possible values for Vdd (measured temperature depends on it)
Definition: sht1x.h:51
@ SHT1X_CONF_LOW_RESOLUTION
Use 8/12 bit resolution instead of 12/14 bit for temp/hum.
Definition: sht1x.h:39
@ SHT1X_CONF_SKIP_CALIBRATION
Don't upload calibration data to register to safe 10 millisec.
Definition: sht1x.h:41
@ SHT1X_CONF_ENABLE_HEATER
Waste 8mA at 5V to increase the sensor temperature up to 10°C.
Definition: sht1x.h:43
@ SHT1X_CONF_SKIP_CRC
Skip the CRC check (and reading the CRC byte) to safe time.
Definition: sht1x.h:45
SHT10/11/15 temperature humidity sensor.
Definition: sht1x.h:62
uint8_t vdd
Supply voltage of the SHT1X (as sht1x_vdd_t)
Definition: sht1x.h:68
int16_t hum_off
Offset to add to the measured humidity.
Definition: sht1x.h:66
gpio_t clk
GPIO connected to the clock pin of the SHT1X.
Definition: sht1x.h:63
gpio_t data
GPIO connected to the data pin of the SHT1X.
Definition: sht1x.h:64
uint8_t conf
Status byte (containing configuration) of the SHT1X.
Definition: sht1x.h:67
int16_t temp_off
Offset to add to the measured temperature.
Definition: sht1x.h:65
Parameters required to set up the SHT10/11/15 device driver.
Definition: sht1x.h:74
gpio_t data
GPIO connected to the data pin of the SHT1X.
Definition: sht1x.h:76
sht1x_vdd_t vdd
The supply voltage of the SHT1X.
Definition: sht1x.h:77
gpio_t clk
GPIO connected to the clock pin of the SHT1X.
Definition: sht1x.h:75