LPS22HB Sensor

The ST LPS22HB is an ultra compact absolute piezoresistive pressure sensor.

Implementation file for the LPS22HB driver class.

Assembly

LPS22HBSensor.h

Summary

Types
DevI2C
PRESSURE_InitTypeDef
Constructors
LPS22HBSensor - LPS22HBSensor(DevI2C &i2c)
LPS22HBSensor - LPS22HBSensor(DevI2C &i2c)
Methods
init - int init(void *init)
deInit - int deInit()
readId - int readId(uint8_t *p_id)
reset - int reset(void)
getPressure - int getPressure(float *pfData)
getTemperature - int getTemperature(float *pfData)

Types

DevI2C

Provides functions for multi-register I2C communication.

PRESSURE_InitTypeDef

PRESSURE init structure definition.

Constructors

LPS22HBSensor

LPS22HBSensor(DevI2C &i2c)

Parameters

Type Name Description
DevI2C & i2c The object of an helper class which handles the I2C peripheral.

LPS22HBSensor

LPS22HBSensor(DevI2C &i2c, unsigned char address)

Parameters

Type Name Description
DevI2C & i2c The object of an helper class which handles the I2C peripheral.
unsigned char address The address of the component’s instance.

Methods

init

int init(void *init)

Initializing the component.

Parameters

Type Name Description
void * init The pointer to device specific initalization structure.

Return value

Type Description
int 0 (PRESSURE_OK) in case of success, an error code otherwise.

deInit

int deInit()

Deinitialize lps22hb sensor device.

Parameters

None.

Return value

Type Description
int 0 (PRESSURE_OK) in case of success, an error code otherwise.

readId

int readId(uint8_t *p_id)

Read ID address of LPS22HB.

Parameters

Type Name Description
uint8_t *p p_id The pointer where the ID of the device is stored.

Return value

Type Description
int 0 (PRESSURE_OK) in case of success, an error code otherwise.

reset

int reset(void)

Reboot memory content of LPS22HB.

Parameters

None.

Return value

Type Description
int 0 (PRESSURE_OK) in case of success, an error code otherwise.

getPressure

int getPressure(float *pfData)

Read LPS22HB output register, and calculate the pressure in mbar.

Parameters

Type Name Description
float * pfData The pressure value in mbar.

Return value

Type Description
int 0 (PRESSURE_OK) in case of success, an error code otherwise.

getTemperature

int getTemperature(float *pfData)

Read LPS22HB output register, and calculate the temperature.

Parameters

Type Name Description
float * pfData The temperature value.

Return value

Type Description
int 0 (PRESSURE_OK) in case of success, an error code otherwise.