Loading...
Searching...
No Matches
sht1x.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2009 Freie Universitaet Berlin (FUB)
3 * SPDX-FileCopyrightText: 2018 Otto-von-Guericke-Universität Magdeburg
4 * SPDX-License-Identifier: LGPL-2.1-only
5 */
6
7#pragma once
8
21
22#include <stdint.h>
23#include <periph/gpio.h>
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
44
48typedef enum {
49 SHT1X_VDD_5_0V = 0,
50 SHT1X_VDD_4_0V = 1,
51 SHT1X_VDD_3_5V = 2,
52 SHT1X_VDD_3_0V = 3,
53 SHT1X_VDD_2_5V = 4,
55
59typedef struct {
60 gpio_t clk;
61 gpio_t data;
62 int16_t temp_off;
63 int16_t hum_off;
64 uint8_t conf;
65 uint8_t vdd;
67
71typedef struct {
72 gpio_t clk;
73 gpio_t data;
76
87int sht1x_init(sht1x_dev_t *dev, const sht1x_params_t *params);
88
99int16_t sht1x_temperature(const sht1x_dev_t *dev, uint16_t raw);
100
113int16_t sht1x_humidity(const sht1x_dev_t *dev, uint16_t raw, int16_t temp);
114
135int sht1x_read(const sht1x_dev_t *dev, int16_t *temp, int16_t *hum);
136
151
164int sht1x_read_status(sht1x_dev_t *dev, uint8_t *status);
165
177
178#ifdef __cplusplus
179}
180#endif
181
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:34
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:48
@ SHT1X_CONF_LOW_RESOLUTION
Use 8/12 bit resolution instead of 12/14 bit for temp/hum.
Definition sht1x.h:36
@ SHT1X_CONF_SKIP_CALIBRATION
Don't upload calibration data to register to safe 10 millisec.
Definition sht1x.h:38
@ SHT1X_CONF_ENABLE_HEATER
Waste 8mA at 5V to increase the sensor temperature up to 10°C.
Definition sht1x.h:40
@ SHT1X_CONF_SKIP_CRC
Skip the CRC check (and reading the CRC byte) to safe time.
Definition sht1x.h:42
SHT10/11/15 temperature humidity sensor.
Definition sht1x.h:59
uint8_t vdd
Supply voltage of the SHT1X (as sht1x_vdd_t)
Definition sht1x.h:65
int16_t hum_off
Offset to add to the measured humidity.
Definition sht1x.h:63
gpio_t clk
GPIO connected to the clock pin of the SHT1X.
Definition sht1x.h:60
gpio_t data
GPIO connected to the data pin of the SHT1X.
Definition sht1x.h:61
uint8_t conf
Status byte (containing configuration) of the SHT1X.
Definition sht1x.h:64
int16_t temp_off
Offset to add to the measured temperature.
Definition sht1x.h:62
Parameters required to set up the SHT10/11/15 device driver.
Definition sht1x.h:71
gpio_t data
GPIO connected to the data pin of the SHT1X.
Definition sht1x.h:73
sht1x_vdd_t vdd
The supply voltage of the SHT1X.
Definition sht1x.h:74
gpio_t clk
GPIO connected to the clock pin of the SHT1X.
Definition sht1x.h:72