Loading...
Searching...
No Matches

Device driver interface for the SDP3x sensor. More...

Detailed Description

Device driver interface for the SDP3x sensor.

Author
Dirk Ehmen ehmen.nosp@m.@ibr.nosp@m..cs.t.nosp@m.u-bs.nosp@m..de
Nishchay Agrawal f2016.nosp@m.088@.nosp@m.pilan.nosp@m.i.bi.nosp@m.ts-pi.nosp@m.lani.nosp@m..ac.i.nosp@m.n

Definition in file sdp3x.h.

#include "saul.h"
#include "xtimer.h"
#include "mutex.h"
#include "periph/i2c.h"
#include "periph/gpio.h"
+ Include dependency graph for sdp3x.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  sdp3x_params_t
 Device initialization parameters. More...
 
struct  sdp3x_t
 Device descriptor for the SDP3x sensor. More...
 
struct  sdp3x_measurement_t
 Measurement from SDP3x sensor. More...
 

Enumerations

enum  {
  SDP3x_OK = 0 , SDP3x_CRCERROR = -1 , SDP3x_NODATA = -2 , SDP3x_IOERROR = -3 ,
  SDP3x_WRONGSIZE = -4
}
 Status and error return codes. More...
 

Functions

int sdp3x_init (sdp3x_t *dev, const sdp3x_params_t *params)
 Initialize SDP3x.
 
int8_t sdp3x_start_continuous (sdp3x_t *dev, uint8_t flags)
 Start Continuous Measuring.
 
int8_t sdp3x_read_continuous (sdp3x_measurement_t *result, sdp3x_t *dev)
 read temperature and differential pressure
 
int32_t sdp3x_read_single_temperature (sdp3x_t *dev, uint8_t flags)
 Read current temperature value.
 
int32_t sdp3x_read_single_differential_pressure (sdp3x_t *dev, uint8_t flags)
 Read current differential_pressure value.
 
int8_t sdp3x_read_single_measurement (sdp3x_t *dev, uint8_t flags, sdp3x_measurement_t *result)
 read temperature and differential pressure
 
int8_t sdp3x_stop_continuous (sdp3x_t *dev, xtimer_t *continuous_timer)
 Stop Continuous Measuring.
 
int8_t sdp3x_soft_reset (const sdp3x_t *dev)
 Resets all I2C devices.
 
int8_t sdp3x_enter_sleep (const sdp3x_t *dev)
 Activates sleep mode.
 
int8_t sdp3x_exit_sleep (const sdp3x_t *dev)
 Exit sleep mode.
 
#define SDP3X_FLAG_MASS_FLOW   0x02
 Flags for sensor reading.
 
#define SDP3X_FLAG_DIFF_PRESS   0x00
 Use Differential Pressure for Temperature Compensation.
 
#define SDP3X_FLAG_AVERAGE   0x01
 Average values.
 
#define SDP3X_FLAG_NO_AVERAGE   0x00
 Don't Average values.
 

Macro Definition Documentation

◆ 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.

Enumeration Type Documentation

◆ anonymous enum

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.

Function Documentation

◆ 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
devdevice
Returns
0 if sleep is activated

◆ sdp3x_exit_sleep()

int8_t sdp3x_exit_sleep ( const sdp3x_t dev)

Exit sleep mode.

Parameters
devdevice
Returns
0 if sleep is deactivated

◆ sdp3x_init()

int sdp3x_init ( sdp3x_t dev,
const sdp3x_params_t params 
)

Initialize SDP3x.

Parameters
devsdp3x device
paramssdp3x device params
Returns
1 if device started

◆ sdp3x_read_continuous()

int8_t sdp3x_read_continuous ( sdp3x_measurement_t result,
sdp3x_t dev 
)

read temperature and differential pressure

Parameters
resultstruct to store result
devsdp3x 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
devsdp3x device
flagsstores Temperature compensation 1st bit-> 0 = Differential pressure, 1 = Mass Flow
Returns
current differential pressure in centipascal

◆ sdp3x_read_single_measurement()

int8_t sdp3x_read_single_measurement ( sdp3x_t dev,
uint8_t  flags,
sdp3x_measurement_t result 
)

read temperature and differential pressure

Parameters
devsdp3x device
flagsstores Temperature compensation 1st bit-> 0 = Differential pressure, 1 = Mass Flow
resultValues 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
devsdp3x device
flagsstores 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
devdevice
Returns
0 if reset is started

◆ sdp3x_start_continuous()

int8_t sdp3x_start_continuous ( sdp3x_t dev,
uint8_t  flags 
)

Start Continuous Measuring.

Parameters
devsdp3x device
flagsstores 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
devdevice
continuous_timertimer running to trigger reading data
Returns
0 if measurement stopped