hsc.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 Deutsches Zentrum für Luft- und Raumfahrt e.V. (DLR)
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 HSC_H
25 #define HSC_H
26 
27 #include "saul.h"
28 #include "periph/i2c.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
37 typedef struct {
39  uint8_t i2c_addr;
40  uint8_t hsc_range;
41 } hsc_params_t;
42 
46 typedef struct {
48 } hsc_t;
49 
60 int hsc_init(hsc_t *dev, const hsc_params_t *params);
61 
72 int hsc_read_temperature(const hsc_t *dev, int16_t *dest);
73 
84 int hsc_read_pressure(const hsc_t *dev, int32_t *dest);
85 
90 #if !defined(CONFIG_HSC_I2C_ADDR) || defined(DOXYGEN)
91 #define CONFIG_HSC_I2C_ADDR (0x28)
92 #endif
93 #if !defined(CONFIG_HSC_RANGE) || defined(DOXYGEN)
94 #define CONFIG_HSC_RANGE (40U)
95 #endif
98 #ifdef __cplusplus
99 }
100 #endif
101 
102 #endif /* HSC_H */
int hsc_read_pressure(const hsc_t *dev, int32_t *dest)
Read pressure value from the given HSC device, returned in uBar.
int hsc_init(hsc_t *dev, const hsc_params_t *params)
Initialize the given HSC device.
int hsc_read_temperature(const hsc_t *dev, int16_t *dest)
Read temperature value from the given HSC device, returned in 0.1°C.
uint_fast8_t i2c_t
Default i2c_t type definition.
Definition: i2c.h:145
Low-level I2C peripheral driver interface definition.
Device initialization parameters.
Definition: hsc.h:37
uint8_t i2c_addr
I2C address.
Definition: hsc.h:39
i2c_t i2c_dev
I2C device which is used.
Definition: hsc.h:38
uint8_t hsc_range
Pressure range in mBar.
Definition: hsc.h:40
Device descriptor for the HSC sensor.
Definition: hsc.h:46
hsc_params_t params
Device initialization parameters.
Definition: hsc.h:47
Functionality for reading [S]ensor [A]ctuator [U]ber [L]ayer sensors as SenML.