LPS22DF Part Drivers API Documentation - Core

This page documents the API of the Core component of the LPS22DF Part Drivers.

An overview of the driver is also available here: main_doc .

Functions

Functions

lps22df_drv_status_t lps22df_drv_init ( lps22df_object_t * p_obj , uint32_t id )

initialize the LPS22DF sensor.

Parameters :
  • p_obj – the device object

  • id – the device instance id

Return values :

0 – in case of success, an error code otherwise

lps22df_drv_status_t lps22df_drv_deinit ( lps22df_object_t * p_obj )

deinitialize the LPS22DF sensor.

Parameters :

p_obj – the device object

Return values :

0 – in case of success, an error code otherwise

lps22df_drv_status_t lps22df_drv_readid ( lps22df_object_t * p_obj , uint8_t * p_id )

Get WHO_AM_I value.

Parameters :
  • p_obj – the device object

  • id – the WHO_AM_I value

Return values :

0 – in case of success, an error code otherwise

lps22df_drv_status_t lps22df_drv_get_init_status ( lps22df_object_t * p_obj , uint8_t * p_status )

get the LPS22DF initialization status.

Parameters :
  • p_obj – the device object

  • status – 1 if initialized, 0 otherwise

Return values :

0 – in case of success, an error code otherwise

lps22df_drv_status_t lps22df_drv_enable ( lps22df_object_t * p_obj )

enable the LPS22DF pressure sensor.

Parameters :

p_obj – the device object

Return values :

0 – in case of success, an error code otherwise

lps22df_drv_status_t lps22df_drv_disable ( lps22df_object_t * p_obj )

disable the LPS22DF pressure sensor.

Parameters :

p_obj – the device object

Return values :

0 – in case of success, an error code otherwise

lps22df_drv_status_t lps22df_drv_get_outputdatarate ( lps22df_object_t * p_obj , float_t * p_odr )

get the LPS22DF pressure sensor output data rate.

Parameters :
  • p_obj – the device p_obj

  • odr – pointer where the output data rate is written

Return values :

0 – in case of success, an error code otherwise

lps22df_drv_status_t lps22df_drv_set_outputdatarate ( lps22df_object_t * p_obj , float_t odr )

set the LPS22DF pressure sensor output data rate.

Parameters :
  • p_obj – the device p_obj

  • odr – the output data rate value to be set

Return values :

0 – in case of success, an error code otherwise

lps22df_drv_status_t lps22df_drv_get_pressure ( lps22df_object_t * p_obj , float_t * p_value )

get the LPS22DF pressure value.

Parameters :
  • p_obj – device object

  • value – pointer where the pressure value is written

Return values :

0 – in case of success, an error code otherwise

lps22df_drv_status_t lps22df_drv_get_press_drdy_status ( lps22df_object_t * p_obj , uint8_t * p_status )

get the LPS22DF pressure data-ready bit value.

Parameters :
  • p_obj – the device p_obj

  • status – the status of the data-ready bit

Return values :

0 – in case of success, an error code otherwise

lps22df_drv_status_t lps22df_drv_get_temperature ( lps22df_object_t * p_obj , float_t * p_value )

get the LPS22DF temperature value.

Parameters :
  • p_obj – the device p_obj

  • value – pointer where the temperature value is written

Return values :

0 – in case of success, an error code otherwise

lps22df_drv_status_t lps22df_drv_get_temp_drdy_status ( lps22df_object_t * p_obj , uint8_t * p_status )

Get the LPS22DF temperature data-ready bit value.

Parameters :
  • p_obj – the device p_obj

  • status – the status of the data-ready bit

Return values :

0 – in case of success, an error code otherwise

lps22df_drv_status_t lps22df_drv_read_reg ( lps22df_object_t * p_obj , uint8_t reg , uint8_t * p_data )

get the LPS22DF register value.

Parameters :
  • p_obj – the device object

  • reg – address to be read

  • data – value to be read

Return values :

0 – in case of success, an error code otherwise

lps22df_drv_status_t lps22df_drv_write_reg ( lps22df_object_t * p_obj , uint8_t reg , uint8_t data )

set the LPS22DF register value.

Parameters :
  • p_obj – the device p_obj

  • reg – address to be written

  • data – value to be written

Return values :

0 – in case of success, an error code otherwise

lps22df_drv_status_t lps22df_drv_set_one_shot ( lps22df_object_t * p_obj )

set the LPS22DF One Shot Mode.

Parameters :

p_obj – the device object

Return values :

0 – in case of success, an error code otherwise

lps22df_drv_status_t lps22df_drv_get_one_shot_status ( lps22df_object_t * p_obj , uint8_t * p_status )

get the LPS22DF one-shot status.

Parameters :
  • p_obj – the device p_obj

  • status – pointer to one-shot status (1 means measurements available, 0 means measurements not available yet)

Return values :

0 – in case of success, an error code otherwise

lps22df_drv_status_t lps22df_drv_enable_drdy_interrupt ( lps22df_object_t * p_obj )

Enable LPS22DF DRDY interrupt mode.

Parameters :

p_obj – the device object

Return values :

0 – in case of success, an error code otherwise

lps22df_drv_status_t lps22df_drv_set_avg ( lps22df_object_t * p_obj , uint8_t avg )

Set the LPS22DF averaging selection.

Parameters :
  • p_obj – the device object

  • avg – averaging selection to be set

Return values :

0 – in case of success, an error code otherwise

lps22df_drv_status_t lps22df_drv_set_lpf ( lps22df_object_t * p_obj , uint8_t lpf )

set the LPS22DF low-pass filter.

Parameters :
  • p_obj – the device p_obj

  • lpf – low-pass filter mode to be set

Return values :

0 – in case of success, an error code otherwise

lps22df_drv_status_t lps22df_drv_enable_irq ( lps22df_object_t * p_obj )

enable the interrupt.

Parameters :

p_obj – the device instance object

Return values :

0 – in case of success, an error code otherwise

lps22df_drv_status_t lps22df_drv_disable_irq ( lps22df_object_t * p_obj )

disable the interrupt.

Parameters :

p_obj – the device instance object

Return values :

0 – in case of success, an error code otherwise

Types

Enums

enum lps22df_drv_status_t

driver status codes.

Values:

enumerator LPS22DF_OK

OK

enumerator LPS22DF_ERROR

Error

Typedefs

typedef struct lps22df_object_s lps22df_object_t

LPS22DF object structure type callback function pointer definition

typedef void ( * lps22df_callback_t ) ( lps22df_object_t * pobj , void * arg )
struct lps22df_cb_ctx_t

Callback context structure.

Public Members

lps22df_callback_t callback

Callback function to register

void * arg

Optional argument given to the callback

struct lps22df_object_s

LPS22DF object structure.

Public Members

lps22df_io_t io_ctx

IO context

stmdev_ctx_t ctx

Device context

uint8_t is_initialized

Initialization status

uint8_t is_enabled

Device enabled status

lps22df_md_t last_odr

Last output data rate

lps22df_cb_ctx_t cb_ctx_irq

IRQ callback ctx

union lps22df_axis3bit16_t
#include <lps22df.h>

3-axis 16-bit raw data.

Public Members

int16_t i16bit [ 3 ]

16-bit data

uint8_t u8bit [ 6 ]

8-bit data

union lps22df_axis1bit16_t
#include <lps22df.h>

1-axis 16-bit raw data.

Public Members

int16_t i16bit

16-bit data

uint8_t u8bit [ 2 ]

8-bit data

union lps22df_axis3bit32_t
#include <lps22df.h>

3-axis 32-bit raw data.

Public Members

int32_t i32bit [ 3 ]

32-bit data

uint8_t u8bit [ 12 ]

8-bit data

union lps22df_axis1bit32_t
#include <lps22df.h>

1-axis 32-bit raw data.

Public Members

int32_t i32bit

32-bit data

uint8_t u8bit [ 4 ]

8-bit data

Constants and macros

Defines

LPS22DF_I2C_BUS 0U

I2C bus

LPS22DF_SPI_4WIRES_BUS 1U

SPI 4-wire bus

LPS22DF_SPI_3WIRES_BUS 2U

SPI 3-wire bus.

LPS22DF_I3C_BUS 3U

I3C bus

LPS22DF_ODR_0HZ_FP 0.0f

ODR 0 Hz

LPS22DF_ODR_1HZ_FP 1.0f

ODR 1 Hz

LPS22DF_ODR_4HZ_FP 4.0f

ODR 4 Hz

LPS22DF_ODR_10HZ_FP 10.0f

ODR 10 Hz

LPS22DF_ODR_25HZ_FP 25.0f

ODR 25 Hz

LPS22DF_ODR_50HZ_FP 50.0f

ODR 50 Hz

LPS22DF_ODR_75HZ_FP 75.0f

ODR 75 Hz

LPS22DF_ODR_100HZ_FP 100.0f

ODR 100 Hz

LPS22DF_ODR_200HZ_FP 200.0f

ODR 200 Hz