Loading...
Searching...
No Matches
shtcx.h
Go to the documentation of this file.
1/*
2 * Copyright 2017, RWTH Aachen. All rights reserved.
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
24#ifndef SHTCX_H
25#define SHTCX_H
26
27#include <stdint.h>
28#include "saul.h"
29
30#include "periph/i2c.h"
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
40#ifndef SHTCX_I2C_ADDRESS
41#define SHTCX_I2C_ADDRESS (0x70)
42#endif
43
48typedef struct {
50 uint8_t i2c_addr;
58typedef struct {
60} shtcx_t;
63enum {
68};
69
80int8_t shtcx_init(shtcx_t* const dev, const shtcx_params_t* params);
81
94int8_t shtcx_read(const shtcx_t *dev, uint16_t *rel_humidity, int16_t *temperature);
95
108int8_t shtcx_id(const shtcx_t *dev, uint16_t *id);
109
120int8_t shtcx_reset(const shtcx_t *dev);
121
122#ifdef __cplusplus
123}
124#endif
125
126#endif /* SHTCX_H */
uint_fast8_t i2c_t
Default i2c_t type definition.
Definition i2c.h:151
int8_t shtcx_init(shtcx_t *const dev, const shtcx_params_t *params)
Initializes the sensor and I2C.
int8_t shtcx_reset(const shtcx_t *dev)
Resets sensor.
int8_t shtcx_id(const shtcx_t *dev, uint16_t *id)
Reads the ID and saves it in the device descriptor.
int8_t shtcx_read(const shtcx_t *dev, uint16_t *rel_humidity, int16_t *temperature)
Reads all register values from the device.
@ SHTCX_ERROR_BUS
I2C bus error.
Definition shtcx.h:65
@ SHTCX_ERROR_CRC
CRC error.
Definition shtcx.h:66
@ SHTCX_OK
Success, no error.
Definition shtcx.h:64
@ SHTCX_ERROR
General error.
Definition shtcx.h:67
Low-level I2C peripheral driver interface definition.
settings struct with all relevant parameters
Definition shtcx.h:48
i2c_t i2c_dev
I2C bus descriptor.
Definition shtcx.h:49
uint8_t i2c_addr
I2C address of the sensor.
Definition shtcx.h:50
device descriptor for the SHTCX
Definition shtcx.h:58
shtcx_params_t params
Parameters struct with all settings set.
Definition shtcx.h:59
Functionality for reading [S]ensor [A]ctuator [U]ber [L]ayer sensors as SenML.