shtc1.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 
22 #ifndef SHTC1_H
23 #define SHTC1_H
24 
25 #include <stdint.h>
26 #include "saul.h"
27 
28 #include "periph/i2c.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
38 #ifndef SHTC1_I2C_ADDRESS
39 #define SHTC1_I2C_ADDRESS (0x70)
40 #endif
41 
46 typedef struct {
48  uint8_t i2c_addr;
56 typedef struct {
58 } shtc1_t;
61 enum {
66 };
67 
78 int8_t shtc1_init(shtc1_t* const dev, const shtc1_params_t* params);
79 
92 int8_t shtc1_read(const shtc1_t *dev, uint16_t *rel_humidity, int16_t *temperature);
93 
105 int8_t shtc1_id(const shtc1_t *dev, uint16_t *id);
106 
117 int8_t shtc1_reset(const shtc1_t *dev);
118 
119 #ifdef __cplusplus
120 }
121 #endif
122 
123 #endif /* SHTC1_H */
124 
shtc1_params_t
settings struct with all relevant parameters
Definition: shtc1.h:46
shtc1_read
int8_t shtc1_read(const shtc1_t *dev, uint16_t *rel_humidity, int16_t *temperature)
Reads all register values from the device.
SHTC1_OK
@ SHTC1_OK
Success, no error.
Definition: shtc1.h:62
SHTC1_ERROR
@ SHTC1_ERROR
General error.
Definition: shtc1.h:65
i2c_t
unsigned int i2c_t
Default i2c_t type definition.
Definition: i2c.h:151
shtc1_t::params
shtc1_params_t params
Parameters struct with all settings set.
Definition: shtc1.h:57
SHTC1_ERROR_BUS
@ SHTC1_ERROR_BUS
I2C bus error.
Definition: shtc1.h:63
shtc1_params_t::i2c_dev
i2c_t i2c_dev
I2C bus descriptor.
Definition: shtc1.h:47
shtc1_params_t::i2c_addr
uint8_t i2c_addr
I2C address of the sensor.
Definition: shtc1.h:48
shtc1_id
int8_t shtc1_id(const shtc1_t *dev, uint16_t *id)
Reads the ID and saves it in the device descriptor.
shtc1_reset
int8_t shtc1_reset(const shtc1_t *dev)
Resets sensor.
saul.h
Definition of the generic [S]ensor [A]ctuator [U]ber [L]ayer.
shtc1_init
int8_t shtc1_init(shtc1_t *const dev, const shtc1_params_t *params)
Initializes the sensor and I2C.
shtc1_t
device descriptor for the SHTC1
Definition: shtc1.h:56
i2c.h
Low-level I2C peripheral driver interface definition.
SHTC1_ERROR_CRC
@ SHTC1_ERROR_CRC
CRC error.
Definition: shtc1.h:64