Loading...
Searching...
No Matches
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
23#ifndef SHT1X_H
24#define SHT1X_H
25
26#include <stdint.h>
27#include <periph/gpio.h>
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
48
52typedef enum {
53 SHT1X_VDD_5_0V = 0,
54 SHT1X_VDD_4_0V = 1,
55 SHT1X_VDD_3_5V = 2,
56 SHT1X_VDD_3_0V = 3,
57 SHT1X_VDD_2_5V = 4,
59
63typedef struct {
64 gpio_t clk;
65 gpio_t data;
66 int16_t temp_off;
67 int16_t hum_off;
68 uint8_t conf;
69 uint8_t vdd;
71
75typedef struct {
76 gpio_t clk;
77 gpio_t data;
80
91int sht1x_init(sht1x_dev_t *dev, const sht1x_params_t *params);
92
103int16_t sht1x_temperature(const sht1x_dev_t *dev, uint16_t raw);
104
117int16_t sht1x_humidity(const sht1x_dev_t *dev, uint16_t raw, int16_t temp);
118
139int sht1x_read(const sht1x_dev_t *dev, int16_t *temp, int16_t *hum);
140
155
168int sht1x_read_status(sht1x_dev_t *dev, uint8_t *status);
169
181
182#ifdef __cplusplus
183}
184#endif
185
186#endif /* SHT1X_H */
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:38
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:52
@ SHT1X_CONF_LOW_RESOLUTION
Use 8/12 bit resolution instead of 12/14 bit for temp/hum.
Definition sht1x.h:40
@ SHT1X_CONF_SKIP_CALIBRATION
Don't upload calibration data to register to safe 10 millisec.
Definition sht1x.h:42
@ SHT1X_CONF_ENABLE_HEATER
Waste 8mA at 5V to increase the sensor temperature up to 10°C.
Definition sht1x.h:44
@ SHT1X_CONF_SKIP_CRC
Skip the CRC check (and reading the CRC byte) to safe time.
Definition sht1x.h:46
SHT10/11/15 temperature humidity sensor.
Definition sht1x.h:63
uint8_t vdd
Supply voltage of the SHT1X (as sht1x_vdd_t)
Definition sht1x.h:69
int16_t hum_off
Offset to add to the measured humidity.
Definition sht1x.h:67
gpio_t clk
GPIO connected to the clock pin of the SHT1X.
Definition sht1x.h:64
gpio_t data
GPIO connected to the data pin of the SHT1X.
Definition sht1x.h:65
uint8_t conf
Status byte (containing configuration) of the SHT1X.
Definition sht1x.h:68
int16_t temp_off
Offset to add to the measured temperature.
Definition sht1x.h:66
Parameters required to set up the SHT10/11/15 device driver.
Definition sht1x.h:75
gpio_t data
GPIO connected to the data pin of the SHT1X.
Definition sht1x.h:77
sht1x_vdd_t vdd
The supply voltage of the SHT1X.
Definition sht1x.h:78
gpio_t clk
GPIO connected to the clock pin of the SHT1X.
Definition sht1x.h:76