Loading...
Searching...
No Matches
sdp3x.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2019 Dirk Ehmen
3 * 2020 Nishchay Agrawal
4 *
5 * This file is subject to the terms and conditions of the GNU Lesser
6 * General Public License v2.1. See the file LICENSE in the top level
7 * directory for more details.
8 */
9
22#ifndef SDP3X_H
23#define SDP3X_H
24
25#include "saul.h"
26#include "xtimer.h"
27#include "mutex.h"
28#include "periph/i2c.h"
29#include "periph/gpio.h"
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
39#define SDP3X_FLAG_MASS_FLOW 0x02
40#define SDP3X_FLAG_DIFF_PRESS 0x00
41#define SDP3X_FLAG_AVERAGE 0x01
42#define SDP3X_FLAG_NO_AVERAGE 0x00
48typedef struct {
50 uint8_t i2c_addr;
51 gpio_t irq_pin;
53
62
66typedef struct {
69 int32_t temperature;
71
75enum {
80 SDP3x_WRONGSIZE = -4
81};
82
91int sdp3x_init(sdp3x_t *dev, const sdp3x_params_t *params);
92
103int8_t sdp3x_start_continuous(sdp3x_t *dev, uint8_t flags);
104
115
126int32_t sdp3x_read_single_temperature(sdp3x_t *dev, uint8_t flags);
127
138 uint8_t flags);
139
150int8_t sdp3x_read_single_measurement(sdp3x_t *dev, uint8_t flags,
151 sdp3x_measurement_t *result);
152
163int8_t sdp3x_stop_continuous(sdp3x_t *dev, xtimer_t *continuous_timer);
164
172int8_t sdp3x_soft_reset(const sdp3x_t *dev);
173
183int8_t sdp3x_enter_sleep(const sdp3x_t *dev);
184
192int8_t sdp3x_exit_sleep(const sdp3x_t *dev);
193
194#ifdef __cplusplus
195}
196#endif
197
198#endif /* SDP3X_H */
Low-level GPIO peripheral driver interface definitions.
uint_fast8_t i2c_t
Default i2c_t type definition.
Definition i2c.h:151
Low-level I2C peripheral driver interface definition.
Mutex for thread synchronization.
int8_t sdp3x_read_continuous(sdp3x_measurement_t *result, sdp3x_t *dev)
read temperature and differential pressure
@ SDP3x_WRONGSIZE
Wrong size of array for method.
Definition sdp3x.h:80
@ SDP3x_NODATA
No Data available.
Definition sdp3x.h:78
@ SDP3x_OK
all went as expected
Definition sdp3x.h:76
@ SDP3x_IOERROR
I/O error.
Definition sdp3x.h:79
@ SDP3x_CRCERROR
CRC-Check failed.
Definition sdp3x.h:77
int32_t sdp3x_read_single_differential_pressure(sdp3x_t *dev, uint8_t flags)
Read current differential_pressure value.
int sdp3x_init(sdp3x_t *dev, const sdp3x_params_t *params)
Initialize SDP3x.
int8_t sdp3x_soft_reset(const sdp3x_t *dev)
Resets all I2C devices.
int32_t sdp3x_read_single_temperature(sdp3x_t *dev, uint8_t flags)
Read current temperature value.
int8_t sdp3x_stop_continuous(sdp3x_t *dev, xtimer_t *continuous_timer)
Stop Continuous Measuring.
int8_t sdp3x_exit_sleep(const sdp3x_t *dev)
Exit sleep mode.
int8_t sdp3x_read_single_measurement(sdp3x_t *dev, uint8_t flags, sdp3x_measurement_t *result)
read temperature and differential pressure
int8_t sdp3x_enter_sleep(const sdp3x_t *dev)
Activates sleep mode.
int8_t sdp3x_start_continuous(sdp3x_t *dev, uint8_t flags)
Start Continuous Measuring.
Mutex structure.
Definition mutex.h:146
Measurement from SDP3x sensor.
Definition sdp3x.h:66
int32_t temperature
Temperature measured in centiĀ°C.
Definition sdp3x.h:69
int32_t differential_pressure
Differential Pressure measured in centiPa.
Definition sdp3x.h:67
Device initialization parameters.
Definition sdp3x.h:48
gpio_t irq_pin
IRQ pin to check data ready.
Definition sdp3x.h:51
uint8_t i2c_addr
I2C address.
Definition sdp3x.h:50
i2c_t i2c_dev
I2C device which is used.
Definition sdp3x.h:49
Device descriptor for the SDP3x sensor.
Definition sdp3x.h:57
mutex_t mutex
Mutex for this sdp3x dev.
Definition sdp3x.h:60
bool continuous_measurement
Device measuring data continuously.
Definition sdp3x.h:58
sdp3x_params_t params
Device initialization parameters.
Definition sdp3x.h:59
xtimer timer structure
Definition xtimer.h:97
Functionality for reading [S]ensor [A]ctuator [U]ber [L]ayer sensors as SenML.
xtimer interface definitions