si70xx.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Bas Stottelaar <basstottelaar@gmail.com>
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 SI70XX_H
25 #define SI70XX_H
26 
27 #include "periph/i2c.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
36 enum {
40 };
41 
45 typedef struct {
47  uint8_t address;
49 
53 typedef struct {
55 } si70xx_t;
56 
68 int si70xx_init(si70xx_t *dev, const si70xx_params_t *params);
69 
76 uint16_t si70xx_get_relative_humidity(const si70xx_t *dev);
77 
85 int16_t si70xx_get_temperature(const si70xx_t *dev);
86 
95 void si70xx_get_both(const si70xx_t *dev, uint16_t *humidity, int16_t *temperature);
96 
103 uint64_t si70xx_get_serial(const si70xx_t *dev);
104 
111 uint8_t si70xx_get_id(const si70xx_t *dev);
112 
119 uint8_t si70xx_get_revision(const si70xx_t *dev);
120 
121 #ifdef __cplusplus
122 }
123 #endif
124 
125 #endif /* SI70XX_H */
126 
si70xx_params_t::address
uint8_t address
sensor address
Definition: si70xx.h:47
SI70XX_ERR_NODEV
@ SI70XX_ERR_NODEV
No valid device found on I2C bus.
Definition: si70xx.h:38
SI70XX_ERR_I2C
@ SI70XX_ERR_I2C
An error occurred when reading/writing on I2C bus.
Definition: si70xx.h:39
si70xx_t
Si70xx device descriptor.
Definition: si70xx.h:53
i2c_t
unsigned int i2c_t
Default i2c_t type definition.
Definition: i2c.h:151
SI70XX_OK
@ SI70XX_OK
All OK.
Definition: si70xx.h:37
si70xx_get_both
void si70xx_get_both(const si70xx_t *dev, uint16_t *humidity, int16_t *temperature)
Read the relative humidity and temperature from the sensor.
si70xx_t::params
si70xx_params_t params
Device parameters.
Definition: si70xx.h:54
si70xx_params_t
Device initialization parameters.
Definition: si70xx.h:45
si70xx_get_serial
uint64_t si70xx_get_serial(const si70xx_t *dev)
Read the sensor serial number.
si70xx_params_t::i2c_dev
i2c_t i2c_dev
I2C bus the sensor is connected to.
Definition: si70xx.h:46
si70xx_get_id
uint8_t si70xx_get_id(const si70xx_t *dev)
Read the sensor id, to identifier the sensor variant.
si70xx_get_revision
uint8_t si70xx_get_revision(const si70xx_t *dev)
Read the firmware revision of the sensor.
si70xx_get_temperature
int16_t si70xx_get_temperature(const si70xx_t *dev)
Read the current temperature from the sensor.
si70xx_get_relative_humidity
uint16_t si70xx_get_relative_humidity(const si70xx_t *dev)
Read the relative humidity from the sensor.
i2c.h
Low-level I2C peripheral driver interface definition.
si70xx_init
int si70xx_init(si70xx_t *dev, const si70xx_params_t *params)
Initialize and reset the sensor.