LPS331AP Pressure Sensor Driver

Device driver for the LPS331AP pressure sensor. More...

Detailed Description

Device driver for the LPS331AP pressure sensor.

Files

file  lps331ap.h
 Device driver interface for the LPS331AP pressure sensor.
 
file  lps331ap-internal.h
 Definitions for the LPS331AP pressure sensor.
 

Data Structures

struct  lps331ap_params_t
 Struct holding all parameters needed for device initialization. More...
 
struct  lps331ap_t
 Device descriptor for LPS331AP sensors. More...
 

Macros

#define LPS331AP_DEFAULT_ADDRESS   (0x5c)
 The sensors default I2C address.
 

Enumerations

enum  lps331ap_rate_t { LPS331AP_RATE_1HZ = 1, LPS331AP_RATE_7HZ = 5, LPS331AP_RATE_12HZ5 = 6, LPS331AP_RATE_25HZ = 7 }
 Possible sampling rates for LPS331AP sensors. More...
 

Functions

int lps331ap_init (lps331ap_t *dev, const lps331ap_params_t *params)
 Initialize a given LPS331AP pressure sensor. More...
 
int lps331ap_read_temp (const lps331ap_t *dev)
 Read a temperature value from the given sensor, returned in m°C. More...
 
int lps331ap_read_pres (const lps331ap_t *dev)
 Read a pressure value from the given sensor, returned in mbar. More...
 
int lps331ap_enable (const lps331ap_t *dev)
 Enable the given sensor. More...
 
int lps331ap_disable (const lps331ap_t *dev)
 Disable the given sensor. More...
 

Enumeration Type Documentation

◆ lps331ap_rate_t

Possible sampling rates for LPS331AP sensors.

Enumerator
LPS331AP_RATE_1HZ 

sample with 1Hz

LPS331AP_RATE_7HZ 

sample with 7Hz

LPS331AP_RATE_12HZ5 

sample with 12.5Hz

LPS331AP_RATE_25HZ 

sample with 25Hz

Definition at line 41 of file lps331ap.h.

Function Documentation

◆ lps331ap_disable()

int lps331ap_disable ( const lps331ap_t dev)

Disable the given sensor.

Parameters
[in]devdevice descriptor of sensor to disable
Returns
0 on success
<0 on error

◆ lps331ap_enable()

int lps331ap_enable ( const lps331ap_t dev)

Enable the given sensor.

Parameters
[in]devdevice descriptor of sensor to enable
Returns
0 on success
<0 on error

◆ lps331ap_init()

int lps331ap_init ( lps331ap_t dev,
const lps331ap_params_t params 
)

Initialize a given LPS331AP pressure sensor.

Parameters
[out]devdevice descriptor of the sensor
[in]paramsinitialization parameters
Returns
0 on success
-1 on error

◆ lps331ap_read_pres()

int lps331ap_read_pres ( const lps331ap_t dev)

Read a pressure value from the given sensor, returned in mbar.

Parameters
[in]devdevice descriptor of sensor to read from
Returns
pressure value in mbar

◆ lps331ap_read_temp()

int lps331ap_read_temp ( const lps331ap_t dev)

Read a temperature value from the given sensor, returned in m°C.

Parameters
[in]devdevice descriptor of sensor to read from
Returns
temperature value in m°C