Device driver interface for the SDP3x sensor.
More...
#include "saul.h"
#include "xtimer.h"
#include "mutex.h"
#include "periph/i2c.h"
#include "periph/gpio.h"
Go to the source code of this file.
◆ SDP3X_FLAG_AVERAGE
#define SDP3X_FLAG_AVERAGE 0x01 |
Average values.
Definition at line 41 of file sdp3x.h.
◆ SDP3X_FLAG_DIFF_PRESS
#define SDP3X_FLAG_DIFF_PRESS 0x00 |
Use Differential Pressure for Temperature Compensation.
Definition at line 40 of file sdp3x.h.
◆ SDP3X_FLAG_MASS_FLOW
#define SDP3X_FLAG_MASS_FLOW 0x02 |
Flags for sensor reading.
Use Mass Flow for Temperature Compensation
Definition at line 39 of file sdp3x.h.
◆ SDP3X_FLAG_NO_AVERAGE
#define SDP3X_FLAG_NO_AVERAGE 0x00 |
Don't Average values.
Definition at line 42 of file sdp3x.h.
◆ anonymous enum
Status and error return codes.
Enumerator |
---|
SDP3x_OK | all went as expected
|
SDP3x_CRCERROR | CRC-Check failed.
|
SDP3x_NODATA | No Data available.
|
SDP3x_IOERROR | I/O error.
|
SDP3x_WRONGSIZE | Wrong size of array for method.
|
Definition at line 75 of file sdp3x.h.
◆ sdp3x_enter_sleep()
int8_t sdp3x_enter_sleep |
( |
const sdp3x_t * |
dev | ) |
|
Activates sleep mode.
Only activates Sleep Mode if the device is in Idle Mode
- Parameters
-
- Returns
- 0 if sleep is activated
◆ sdp3x_exit_sleep()
int8_t sdp3x_exit_sleep |
( |
const sdp3x_t * |
dev | ) |
|
Exit sleep mode.
- Parameters
-
- Returns
- 0 if sleep is deactivated
◆ sdp3x_init()
Initialize SDP3x.
- Parameters
-
dev | sdp3x device |
params | sdp3x device params |
- Returns
- 1 if device started
◆ sdp3x_read_continuous()
read temperature and differential pressure
- Parameters
-
result | struct to store result |
dev | sdp3x device |
- Returns
- 1 on success
◆ sdp3x_read_single_differential_pressure()
int32_t sdp3x_read_single_differential_pressure |
( |
sdp3x_t * |
dev, |
|
|
uint8_t |
flags |
|
) |
| |
Read current differential_pressure value.
- Parameters
-
dev | sdp3x device |
flags | stores Temperature compensation 1st bit-> 0 = Differential pressure, 1 = Mass Flow |
- Returns
- current differential pressure in centipascal
◆ sdp3x_read_single_measurement()
read temperature and differential pressure
- Parameters
-
dev | sdp3x device |
flags | stores Temperature compensation 1st bit-> 0 = Differential pressure, 1 = Mass Flow |
result | Values are stored in this struct |
- Returns
- 1 on success
◆ sdp3x_read_single_temperature()
int32_t sdp3x_read_single_temperature |
( |
sdp3x_t * |
dev, |
|
|
uint8_t |
flags |
|
) |
| |
Read current temperature value.
- Parameters
-
dev | sdp3x device |
flags | stores Temperature compensation 1st bit-> 0 = Differential pressure, 1 = Mass Flow |
- Returns
- Current temperature in celsius multiplied by 100 to preserve accuracy and return in integer
◆ sdp3x_soft_reset()
int8_t sdp3x_soft_reset |
( |
const sdp3x_t * |
dev | ) |
|
Resets all I2C devices.
- Parameters
-
- Returns
- 0 if reset is started
◆ sdp3x_start_continuous()
int8_t sdp3x_start_continuous |
( |
sdp3x_t * |
dev, |
|
|
uint8_t |
flags |
|
) |
| |
Start Continuous Measuring.
- Parameters
-
dev | sdp3x device |
flags | stores Temperature compensation and averaging flags 0th bit-> 0 = No averaging, 1 = Average values 1st bit-> 0 = Differential pressure, 1 = Mass Flow |
- Returns
- 1 if device started
◆ sdp3x_stop_continuous()
int8_t sdp3x_stop_continuous |
( |
sdp3x_t * |
dev, |
|
|
xtimer_t * |
continuous_timer |
|
) |
| |
Stop Continuous Measuring.
It takes 500 us till next command.
- Parameters
-
dev | device |
continuous_timer | timer running to trigger reading data |
- Returns
- 0 if measurement stopped