LPS22HH Part Drivers API Documentation - Core

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

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

Functions

Functions

lps22hh_drv_status_t lps22hh_drv_init ( lps22hh_object_t * p_obj , uint32_t id )

Initialize the LPS22HH sensor.

Parameters :
  • p_obj – the device instance object

  • id – the device instance id

Return values :

0 – in case of success, an error code otherwise

lps22hh_drv_status_t lps22hh_drv_deinit ( lps22hh_object_t * p_obj )

Deinitialize the LPS22HH sensor.

Parameters :

p_obj – the device instance object

Return values :

0 – in case of success, an error code otherwise

lps22hh_drv_status_t lps22hh_drv_read_id ( lps22hh_object_t * p_obj , uint8_t * id )

Read the LPS22HH id.

Parameters :
  • p_obj – the device instance object

  • id – the pointer where the id is written

Return values :

0 – in case of success, an error code otherwise

lps22hh_drv_status_t lps22hh_drv_get_init_status ( lps22hh_object_t * p_obj , uint8_t * p_status )

Get the LPS22HH initialization status.

Parameters :
  • p_obj – the device instance object

  • p_status – 1 if initialized, 0 otherwise

Return values :

0 – in case of success, an error code otherwise

lps22hh_drv_status_t lps22hh_drv_enable ( lps22hh_object_t * p_obj )

Enable the LPS22HH pressure sensor.

Parameters :

p_obj – the device instance object

Return values :

0 – in case of success, an error code otherwise

lps22hh_drv_status_t lps22hh_drv_disable ( lps22hh_object_t * p_obj )

Disable the LPS22HH pressure sensor.

Parameters :

p_obj – the device instance object

Return values :

0 – in case of success, an error code otherwise

lps22hh_drv_status_t lps22hh_drv_get_outputdatarate ( lps22hh_object_t * p_obj , float_t * odr )

Get the output data rate.

Parameters :
  • p_obj – the device instance object

  • odr – pointer where the output data rate is written

Return values :

0 – in case of success, an error code otherwise

lps22hh_drv_status_t lps22hh_drv_set_outputdatarate ( lps22hh_object_t * p_obj , float_t odr )

Set the LPS22HH pressure sensor output data rate.

Parameters :
  • p_obj – the device instance object

  • odr – the output data rate value to be set

Return values :

0 – in case of success, an error code otherwise

lps22hh_drv_status_t lps22hh_drv_get_pressure ( lps22hh_object_t * p_obj , float_t * value )

Get the LPS22HH pressure value.

Parameters :
  • p_obj – the device instance object

  • value – pointer where the pressure value is written

Return values :

0 – in case of success, an error code otherwise

lps22hh_drv_status_t lps22hh_drv_get_temperature ( lps22hh_object_t * p_obj , float_t * value )

Get the LPS22HH temperature value.

Parameters :
  • p_obj – the device instance object

  • value – pointer where the temperature value is written

Return values :

0 – in case of success, an error code otherwise

lps22hh_drv_status_t lps22hh_drv_temp_get_drdy_status ( lps22hh_object_t * p_obj , uint8_t * p_status )

Get the LPS22HH temperature data ready bit value.

Parameters :
  • p_obj – the device instance object

  • p_status – the status of data ready bit

Return values :

0 – in case of success, an error code otherwise

lps22hh_drv_status_t lps22hh_drv_press_get_drdy_status ( lps22hh_object_t * p_obj , uint8_t * p_status )

Get the LPS22HH pressure data ready bit value.

Parameters :
  • p_obj – the device instance object

  • p_status – the status of data ready bit

Return values :

0 – in case of success, an error code otherwise

lps22hh_drv_status_t lps22hh_drv_read_reg ( lps22hh_object_t * p_obj , uint8_t reg , uint8_t * p_data )

Wrap Read register component function to Bus IO function.

Parameters :
  • p_obj – the device instance object

  • reg – the register address

  • p_data – pointer where the register value is written

Return values :

0 – in case of success, an error code otherwise

lps22hh_drv_status_t lps22hh_drv_write_reg ( lps22hh_object_t * p_obj , uint8_t reg , uint8_t data )

Override the LPS22HH write register weak function.

Parameters :
  • p_obj – the device instance object

  • reg – the device register to write

  • p_data – data to be written

Return values :

0 – in case of success, an error code otherwise

lps22hh_drv_status_t lps22hh_drv_fifo_get_data ( lps22hh_object_t * p_obj , float_t * press , float_t * temp )

Get the LPS22HH FIFO data level.

Parameters :
  • p_obj – the device instance object

  • press – pointer where the temperature value is written

  • temp – pointer where the pressure value is written

Return values :

0 – in case of success, an error code otherwise

lps22hh_drv_status_t lps22hh_drv_fifo_get_fth_status ( lps22hh_object_t * p_obj , uint8_t * p_status )

Get the LPS22HH FIFO threshold.

Parameters :
  • p_obj – the device instance object

  • p_status – the status of data ready bit

Return values :

0 – in case of success, an error code otherwise

lps22hh_drv_status_t lps22hh_drv_fifo_get_full_status ( lps22hh_object_t * p_obj , uint8_t * p_status )

Get the LPS22HH FIFO full status.

Parameters :
  • p_obj – the device instance object

  • p_status – the status of data ready bit

Return values :

0 – in case of success, an error code otherwise

lps22hh_drv_status_t lps22hh_drv_fifo_get_ovr_status ( lps22hh_object_t * p_obj , uint8_t * p_status )

Get the LPS22HH FIFO OVR status.

Parameters :
  • p_obj – the device instance object

  • p_status – the status of data ready bit

Return values :

0 – in case of success, an error code otherwise

lps22hh_drv_status_t lps22hh_drv_fifo_get_level ( lps22hh_object_t * p_obj , uint8_t * p_status )

Get the LPS22HH FIFO data level.

Parameters :
  • p_obj – the device instance object

  • p_status – the status of data ready bit

Return values :

0 – in case of success, an error code otherwise

lps22hh_drv_status_t lps22hh_drv_fifo_reset_interrupt ( lps22hh_object_t * p_obj , uint8_t interrupt )

Reset the FIFO interrupt.

Parameters :
  • p_obj – the device instance object

  • interrupt – The FIFO interrupt to be reset; values: 0 = FTH; 1 = FULL; 2 = OVR

Return values :

0 – in case of success, an error code otherwise

lps22hh_drv_status_t lps22hh_drv_fifo_set_interrupt ( lps22hh_object_t * p_obj , uint8_t interrupt )

Set the FIFO interrupt.

Parameters :
  • p_obj – the device instance object

  • interrupt – The FIFO interrupt to be reset; values: 0 = FTH; 1 = FULL; 2 = OVR

Return values :

0 – in case of success, an error code otherwise

lps22hh_drv_status_t lps22hh_drv_fifo_set_mode ( lps22hh_object_t * p_obj , uint8_t mode )

Set the FIFO mode.

Parameters :
  • p_obj – the device instance object

  • mode – the FIFO mode to be set

Return values :

0 – in case of success, an error code otherwise

lps22hh_drv_status_t lps22hh_drv_fifo_set_watermark_level ( lps22hh_object_t * p_obj , uint8_t watermark )

Set the LPS22HH FIFO data level.

Parameters :
  • p_obj – the device instance object

  • watermark – the status of data ready bit

Return values :

0 – in case of success, an error code otherwise

lps22hh_drv_status_t lps22hh_drv_fifo_stop_on_watermark ( lps22hh_object_t * p_obj , uint8_t stop )

Set the LPS22HH stop on watermark function.

Parameters :
  • p_obj – the device instance object

  • stop – the state of stop on watermark function

Return values :

0 – in case of success, an error code otherwise

lps22hh_drv_status_t lps22hh_drv_set_one_shot ( lps22hh_object_t * p_obj )

Set the LPS22HH One Shot mode.

Parameters :

p_obj – the device instance object

Return values :

0 – in case of success, an error code otherwise

lps22hh_drv_status_t lps22hh_drv_get_one_shot_status ( lps22hh_object_t * p_obj , uint8_t * p_status )

Get the LPS22HH One Shot status.

Parameters :
  • p_obj – the device instance object

  • p_status – pointer to the one shot status

Return values :

0 – in case of success, an error code otherwise

lps22hh_drv_status_t lps22hh_drv_enable_drdy_interrupt ( lps22hh_object_t * p_obj )

Enable LPS22HH DRDY interrupt mode.

Parameters :

p_obj – the device instance object

Return values :

0 – in case of success, an error code otherwise

lps22hh_drv_status_t lps22hh_drv_set_power_mode ( lps22hh_object_t * p_obj , uint8_t powermode )

Set the LPS22HH power mode.

Parameters :
  • p_obj – the device instance object

  • powermode – mode to be set

Return values :

0 – in case of success, an error code otherwise

lps22hh_drv_status_t lps22hh_drv_set_filter_mode ( lps22hh_object_t * p_obj , uint8_t filtermode )

Set the LPS22HH filter mode.

Parameters :
  • p_obj – the device instance object

  • filtermode – to be set

Return values :

0 – in case of success, an error code otherwise

lps22hh_drv_status_t lps22hh_drv_enable_irq ( lps22hh_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

lps22hh_drv_status_t lps22hh_drv_disable_irq ( lps22hh_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

lps22hh_drv_status_t lps22hh_drv_register_callback ( lps22hh_object_t * pobj , lps22hh_callback_t cb , void * arg )

Register the callback function for interrupt events.

Parameters :
  • p_obj – the device instance object

  • cb – the callback function

  • arg – the optional argument given to the callback

Return values :

0 – in case of success, an error code otherwise

Types

Enums

enum lps22hh_fifomode

Fifo mode.

Values:

enumerator LPS22HH_FIFO_BYPASS_MODE

The FIFO is disabled and empty. The pressure is read directly

enumerator LPS22HH_FIFO_FIFO_MODE

Stops collecting data when full

enumerator LPS22HH_FIFO_STREAM_MODE

Keep the newest measurements in the FIFO

enumerator LPS22HH_FIFO_TRIGGER_STREAMTOFIFO_MODE

STREAM MODE until trigger deasserted, then change to FIFO MODE

enumerator LPS22HH_FIFO_TRIGGER_BYPASSTOSTREAM_MODE

BYPASS MODE until trigger deasserted, then STREAM MODE

enumerator LPS22HH_FIFO_TRIGGER_BYPASSTOFIFO_MODE

BYPASS mode until trigger deasserted, then FIFO MODE

enum lps22hh_drv_status_t

Values:

enumerator LPS22HH_OK
enumerator LPS22HH_ERROR

Typedefs

typedef struct lps22hh_object_s lps22hh_object_t

LPS22HH object structure type callback function pointer definition

typedef void ( * lps22hh_callback_t ) ( lps22hh_object_t * pobj , void * arg )

Constants and macros