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 
21 #ifndef SI70XX_H
22 #define SI70XX_H
23 
24 #include "periph/i2c.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
33 enum {
38 };
39 
43 typedef struct {
45  uint8_t address;
47 
51 typedef struct {
53 } si70xx_t;
54 
66 int si70xx_init(si70xx_t *dev, const si70xx_params_t *params);
67 
74 uint16_t si70xx_get_relative_humidity(const si70xx_t *dev);
75 
83 int16_t si70xx_get_temperature(const si70xx_t *dev);
84 
93 void si70xx_get_both(const si70xx_t *dev, uint16_t *humidity, int16_t *temperature);
94 
101 uint64_t si70xx_get_serial(const si70xx_t *dev);
102 
109 uint8_t si70xx_get_id(const si70xx_t *dev);
110 
117 uint8_t si70xx_get_revision(const si70xx_t *dev);
118 
119 #ifdef __cplusplus
120 }
121 #endif
122 
123 #endif /* SI70XX_H */
124 
si70xx_params_t params
Device parameters.
Definition: si70xx.h:52
int16_t si70xx_get_temperature(const si70xx_t *dev)
Read the current temperature from the sensor.
uint64_t si70xx_get_serial(const si70xx_t *dev)
Read the sensor serial number.
All OK.
Definition: si70xx.h:34
uint8_t si70xx_get_id(const si70xx_t *dev)
Read the sensor id, to identifier the sensor variant.
An error occured when reading/writing on I2C bus.
Definition: si70xx.h:37
unsigned int i2c_t
Default i2c_t type definition.
Definition: i2c.h:108
Si70xx device descriptor.
Definition: si70xx.h:51
void si70xx_get_both(const si70xx_t *dev, uint16_t *humidity, int16_t *temperature)
Read the relative humidity and temperature from the sensor.
No valid device found on I2C bus.
Definition: si70xx.h:36
uint8_t si70xx_get_revision(const si70xx_t *dev)
Read the firmware revision of the sensor.
int si70xx_init(si70xx_t *dev, const si70xx_params_t *params)
Initialize and reset the sensor.
i2c_t i2c_dev
I2C bus the sensor is connected to.
Definition: si70xx.h:44
uint8_t address
sensor address
Definition: si70xx.h:45
An error occurred when initializing I2C bus.
Definition: si70xx.h:35
Device initialization parameters.
Definition: si70xx.h:43
uint16_t si70xx_get_relative_humidity(const si70xx_t *dev)
Read the relative humidity from the sensor.
Low-level I2C peripheral driver interface definition.