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 to 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 to 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 to 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 the 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 the 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 – the 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 pressure value is written
temp – pointer where the temperature 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 the 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 the 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 the 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 the 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 set; 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 FIFO watermark level
- 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 the 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 – the 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
mode – 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
¶
-
Keeps the newest measurements in the FIFO
-
enumerator
LPS22HH_FIFO_TRIGGER_STREAMTOFIFO_MODE
¶
-
STREAM MODE until trigger deasserted, then changes 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
-
enumerator
LPS22HH_FIFO_BYPASS_MODE
¶
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
)
¶
-
struct
lps22hh_cb_ctx_t
¶
-
Callback context structure.
Public Members
-
lps22hh_callback_t
callback
¶
-
Callback function to register
-
void
*
arg
¶
-
Optional argument given to the callback
-
lps22hh_callback_t
callback
¶
-
struct
lps22hh_object_s
¶
-
LPS22HH object structure.
-
union
lps22hh_axis3bit16_t
¶
-
#include <lps22hh.h>
LPS22HH 3-axis 16-bit union.
-
union
lps22hh_axis1bit16_t
¶
-
#include <lps22hh.h>
LPS22HH 1 axis 16-bit union.
-
union
lps22hh_axis3bit32_t
¶
-
#include <lps22hh.h>
LPS22HH 3-axis 32-bit union.
-
union
lps22hh_axis1bit32_t
¶
-
#include <lps22hh.h>
LPS22HH 1-axis 32-bit union.
-
union
lps22hh_axis1bitu32_t
¶
-
#include <lps22hh.h>
LPS22HH 1-axis 32-bit union.
Constants and macros ¶
Defines
-
LPS22HH_I2C_BUS
0U
¶
-
LPS22HH I2C BUS
-
LPS22HH_SPI_4WIRES_BUS
1U
¶
-
LPS22HH SPI 4 WIRES BUS
-
LPS22HH_SPI_3WIRES_BUS
2U
¶
-
LPS22HH SPI 4 WIRES BUS
-
LPS22HH_FIFO_FULL
(uint8_t)0x20
¶
-
LPS22HH FIFO FULL
-
LPS22HH_LOW_NOISE_DIS
0
¶
-
LPS22HH low noise mode
LPS22HH LOW NOISE MODE DISABLED
-
LPS22HH_LOW_NOISE_EN
1
¶
-
LPS22HH LOW NOISE MODE ENABLED
-
LPS22HH_ODR_1_HZ_FP
1.0f
¶
-
LPS22HH ODR 1 Hz
-
LPS22HH_ODR_10_HZ_FP
10.0f
¶
-
LPS22HH ODR 10 Hz
-
LPS22HH_ODR_25_HZ_FP
25.0f
¶
-
LPS22HH ODR 25 Hz
-
LPS22HH_ODR_50_HZ_FP
50.0f
¶
-
LPS22HH ODR 50 Hz
-
LPS22HH_ODR_75_HZ_FP
75.0f
¶
-
LPS22HH ODR 75 Hz
-
LPS22HH_ODR_100_HZ_FP
100.0f
¶
-
LPS22HH ODR 100 Hz
-
LPS22HH_ODR_200_HZ_FP
200.0f
¶
-
LPS22HH ODR 200 Hz
-
LPS22HH_MAX_ODR
200.0f
¶
-
LPS22HH TEMP MAX ODR