The friendly Operating System for the Internet of Things
LPS331AP Pressure Sensor Driver

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

Detailed Description

Files

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

Data Structures

struct  lps331ap_t
 Device descriptor for LPS331AP sensors. More...
 
struct  lps331ap_params_t
 Struct holding all parameters needed for device initialization. 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, i2c_t i2c, uint8_t address, lps331ap_rate_t rate)
 Initialize a given LPS331AP pressure sensor. More...
 
int lps331ap_read_temp (lps331ap_t *dev)
 Read a temperature value from the given sensor, returned in m°C. More...
 
int lps331ap_read_pres (lps331ap_t *dev)
 Read a pressure value from the given sensor, returned in mbar. More...
 
int lps331ap_enable (lps331ap_t *dev)
 Enable the given sensor. More...
 
int lps331ap_disable (lps331ap_t *dev)
 Disable the given sensor. More...
 

Enumeration Type Documentation

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 49 of file lps331ap.h.

Function Documentation

int lps331ap_disable ( lps331ap_t dev)
Parameters
[in]devdevice descriptor of sensor to disable
Returns
0 on success
-1 on error
int lps331ap_enable ( lps331ap_t dev)
Parameters
[in]devdevice descriptor of sensor to enable
Returns
0 on success
-1 on error
int lps331ap_init ( lps331ap_t dev,
i2c_t  i2c,
uint8_t  address,
lps331ap_rate_t  rate 
)
Parameters
[out]devdevice descriptor of the sensor
[in]i2cI2C bus the sensor is connected to
[in]addressthe sensor's address on the I2C bus
[in]rateinternal sampling rate of the sensor
Returns
0 on success
-1 on error
int lps331ap_read_pres ( lps331ap_t dev)
Parameters
[in]devdevice descriptor of sensor to read from
Returns
pressure value in mbar
int lps331ap_read_temp ( lps331ap_t dev)
Parameters
[in]devdevice descriptor of sensor to read from
Returns
temperature value in m°C