LPS331AP/LPS25HB/LPS22HB Pressure Sensors Driver

Device driver for the LPSXXX pressure sensor family (LPS331AP/LPS25HB/LPS22HB) More...

Detailed Description

Device driver for the LPSXXX pressure sensor family (LPS331AP/LPS25HB/LPS22HB)

This driver provides [S]ensor [A]ctuator [U]ber [L]ayer capabilities.

Note
This driver uses the sensors I2C interface

Modules

 LPS331AP/LPS25HB/LPS22HB driver compile configuration
 

Files

file  lpsxxx.h
 
file  lpsxxx_internal.h
 Definitions for the LPSXXX family of pressure sensors.
 
file  lpsxxx_params.h
 Default configuration for LPSXXX family of devices.
 

Data Structures

struct  lpsxxx_params_t
 Struct holding all parameters needed for device initialization. More...
 
struct  lpsxxx_t
 Device descriptor for LPSXXX sensors. More...
 

Macros

#define LPSXXX_DEFAULT_RATE   (LPSXXX_RATE_25HZ)
 The sensors default output data rate (ODR)
 

Enumerations

enum  { LPSXXX_OK, LPSXXX_ERR_NODEV, LPSXXX_ERR_I2C }
 Return codes. More...
 
enum  lpsxxx_rate_t { LPSXXX_RATE_1HZ = 1 }
 Possible sampling rates for LPS331AP sensors. More...
 

Functions

int lpsxxx_init (lpsxxx_t *dev, const lpsxxx_params_t *params)
 Initialize a given LPSXXX pressure sensor. More...
 
int lpsxxx_read_temp (const lpsxxx_t *dev, int16_t *temp)
 Read a temperature value from the given sensor, returned in c°C. More...
 
int lpsxxx_read_pres (const lpsxxx_t *dev, uint16_t *pres)
 Read a pressure value from the given sensor, returned in hPa. More...
 
int lpsxxx_enable (const lpsxxx_t *dev)
 Enable the given sensor. More...
 
int lpsxxx_disable (const lpsxxx_t *dev)
 Disable the given sensor. More...
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Return codes.

Enumerator
LPSXXX_OK 

Everything was fine.

LPSXXX_ERR_NODEV 

No valid device found.

LPSXXX_ERR_I2C 

An error occurred on the I2C bus.

Definition at line 60 of file lpsxxx.h.

◆ lpsxxx_rate_t

Possible sampling rates for LPS331AP sensors.

Enumerator
LPSXXX_RATE_1HZ 

sample with 1Hz

Definition at line 69 of file lpsxxx.h.

Function Documentation

◆ lpsxxx_disable()

int lpsxxx_disable ( const lpsxxx_t dev)

Disable the given sensor.

Parameters
[in]devdevice descriptor of sensor to disable
Returns
LPSXXX_OK on success
-LPSXXX_ERR_I2C on I2C error

◆ lpsxxx_enable()

int lpsxxx_enable ( const lpsxxx_t dev)

Enable the given sensor.

Parameters
[in]devdevice descriptor of sensor to enable
Returns
LPSXXX_OK on success
-LPSXXX_ERR_I2C on I2C error

◆ lpsxxx_init()

int lpsxxx_init ( lpsxxx_t dev,
const lpsxxx_params_t params 
)

Initialize a given LPSXXX pressure sensor.

Parameters
[out]devdevice descriptor of the sensor
[in]paramsinitialization parameters
Returns
LPSXXX_OK on success
-LPSXXX_ERR_NODEV if no valid device found
-LPSXXX_ERR_I2C on I2C error

◆ lpsxxx_read_pres()

int lpsxxx_read_pres ( const lpsxxx_t dev,
uint16_t *  pres 
)

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

Parameters
[in]devdevice descriptor of sensor to read from
[out]prespressure value in hPa
Returns
LPSXXX_OK on success
-LPSXXX_ERR_I2C on I2C error

◆ lpsxxx_read_temp()

int lpsxxx_read_temp ( const lpsxxx_t dev,
int16_t *  temp 
)

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

Parameters
[in]devdevice descriptor of sensor to read from
[out]temptemperature value in c°C
Returns
LPSXXX_OK on success
-LPSXXX_ERR_I2C on I2C error