ST / LPS22HH

Dependencies:   X_NUCLEO_COMMON ST_INTERFACES

Dependents:   X_NUCLEO_IKS01A3 X_NUCLEO_IKS01A3

Embed: (wiki syntax)

« Back to documentation index

LPS22HHSensor Class Reference

LPS22HHSensor Class Reference

Abstract class of a LPS22HH pressure sensor. More...

#include <LPS22HHSensor.h>

Public Member Functions

 LPS22HHSensor (SPI *spi, PinName cs_pin, PinName int_pin=NC, SPI_type_t spi_type=SPI4W)
 Constructor.
 LPS22HHSensor (DevI2C *i2c, uint8_t address=LPS22HH_I2C_ADD_H, PinName int_pin=NC)
 Constructor.
virtual int init (void *init)
 Initializing the component.
virtual int read_id (uint8_t *id)
 Get WHO_AM_I value.
virtual int get_pressure (float *value)
 Get the LPS22HH pressure value.
virtual int get_temperature (float *value)
 Get the LPS22HH temperature value.
int enable (void)
 Enable the LPS22HH pressure sensor.
int disable (void)
 Disable the LPS22HH pressure sensor.
int get_odr (float *odr)
 Get output data rate.
int set_odr (float odr)
 Set the LPS22HH pressure sensor output data rate.
int read_reg (uint8_t reg, uint8_t *data)
 Get the LPS22HH register value.
int write_reg (uint8_t reg, uint8_t data)
 Set the LPS22HH register value.
int get_press_drdy_status (uint8_t *status)
 Get the LPS22HH pressure data ready bit value.
int get_temp_drdy_status (uint8_t *status)
 Get the LPS22HH temperature data ready bit value.
int get_fifo_data (float *press, float *temp)
 Get the LPS22HH FIFO data.
int get_fifo_fth_status (uint8_t *status)
 Get the LPS22HH FIFO threshold.
int get_fifo_full_status (uint8_t *status)
 Get the LPS22HH FIFO full status.
int get_fifo_ovr_status (uint8_t *status)
 Get the LPS22HH FIFO OVR status.
int get_fifo_level (uint8_t *status)
 Get the LPS22HH FIFO data level.
int reset_fifo_interrupt (uint8_t interrupt)
 Reset the FIFO interrupt.
int set_fifo_interrupt (uint8_t interrupt)
 Set the FIFO interrupt.
int set_fifo_mode (uint8_t mode)
 Set the FIFO mode.
int set_fifo_watermark_level (uint8_t watermark)
 Set the LPS22HH FIFO watermark level.
int stop_fifo_on_watermark (uint8_t stop)
 Set the LPS22HH stop on watermark function.
int set_one_shot ()
 Set the LPS22HH One Shot Mode.
int get_one_shot_status (uint8_t *status)
 Get the LPS22HH One Shot Status.
void attach_int_irq (void(*fptr)(void))
 Attaching an interrupt handler to the INT interrupt.
void enable_int_irq (void)
 Enabling the INT interrupt handling.
void disable_int_irq (void)
 Disabling the INT interrupt handling.
uint8_t io_read (uint8_t *pBuffer, uint8_t RegisterAddr, uint16_t NumByteToRead)
 Utility function to read data.
uint8_t io_write (uint8_t *pBuffer, uint8_t RegisterAddr, uint16_t NumByteToWrite)
 Utility function to write data.

Detailed Description

Abstract class of a LPS22HH pressure sensor.

Definition at line 60 of file LPS22HHSensor.h.


Constructor & Destructor Documentation

LPS22HHSensor ( SPI *  spi,
PinName  cs_pin,
PinName  int_pin = NC,
SPI_type_t  spi_type = SPI4W 
)

Constructor.

Parameters:
spiobject of an helper class which handles the SPI peripheral
cs_pinthe chip select pin
int_pinthe interrupt pin
spi_typethe SPI type

Definition at line 52 of file LPS22HHSensor.cpp.

LPS22HHSensor ( DevI2C *  i2c,
uint8_t  address = LPS22HH_I2C_ADD_H,
PinName  int_pin = NC 
)

Constructor.

Parameters:
i2cobject of an helper class which handles the I2C peripheral
addressthe address of the component's instance
int_pinthe interrupt pin

Definition at line 81 of file LPS22HHSensor.cpp.


Member Function Documentation

void attach_int_irq ( void(*)(void)  fptr )

Attaching an interrupt handler to the INT interrupt.

Parameters:
fptran interrupt handler.
Return values:
None.

Definition at line 95 of file LPS22HHSensor.h.

int disable ( void   )

Disable the LPS22HH pressure sensor.

Return values:
0in case of success, an error code otherwise

Definition at line 168 of file LPS22HHSensor.cpp.

void disable_int_irq ( void   )

Disabling the INT interrupt handling.

Parameters:
None.
Return values:
None.

Definition at line 115 of file LPS22HHSensor.h.

int enable ( void   )

Enable the LPS22HH pressure sensor.

Return values:
0in case of success, an error code otherwise

Definition at line 147 of file LPS22HHSensor.cpp.

void enable_int_irq ( void   )

Enabling the INT interrupt handling.

Parameters:
None.
Return values:
None.

Definition at line 105 of file LPS22HHSensor.h.

int get_fifo_data ( float *  press,
float *  temp 
)

Get the LPS22HH FIFO data.

Parameters:
pressthe pointer where FIFO pressure value is stored
tempthe pointer where FIFO temperature value is stored
Return values:
0in case of success, an error code otherwise

Definition at line 410 of file LPS22HHSensor.cpp.

int get_fifo_fth_status ( uint8_t *  status )

Get the LPS22HH FIFO threshold.

Parameters:
statusthe status of FIFO threshold
Return values:
0in case of success, an error code otherwise

Definition at line 437 of file LPS22HHSensor.cpp.

int get_fifo_full_status ( uint8_t *  status )

Get the LPS22HH FIFO full status.

Parameters:
statusthe status of FIFO full status
Return values:
0in case of success, an error code otherwise

Definition at line 451 of file LPS22HHSensor.cpp.

int get_fifo_level ( uint8_t *  status )

Get the LPS22HH FIFO data level.

Parameters:
statusthe status of FIFO data level
Return values:
0in case of success, an error code otherwise

Definition at line 479 of file LPS22HHSensor.cpp.

int get_fifo_ovr_status ( uint8_t *  status )

Get the LPS22HH FIFO OVR status.

Parameters:
statusthe status of FIFO OVR status
Return values:
0in case of success, an error code otherwise

Definition at line 465 of file LPS22HHSensor.cpp.

int get_odr ( float *  odr )

Get output data rate.

Parameters:
odrthe output data rate value
Return values:
0in case of success, an error code otherwise

Definition at line 196 of file LPS22HHSensor.cpp.

int get_one_shot_status ( uint8_t *  status )

Get the LPS22HH One Shot Status.

Parameters:
statuspointer to the one shot status (1 means measurements available, 0 means measurements not available yet)
Return values:
0in case of success, an error code otherwise

Definition at line 622 of file LPS22HHSensor.cpp.

int get_press_drdy_status ( uint8_t *  status )

Get the LPS22HH pressure data ready bit value.

Parameters:
statusthe status of data ready bit
Return values:
0in case of success, an error code otherwise

Definition at line 332 of file LPS22HHSensor.cpp.

int get_pressure ( float *  value ) [virtual]

Get the LPS22HH pressure value.

Parameters:
valuepointer where the pressure value is written
Return values:
0in case of success, an error code otherwise

Definition at line 313 of file LPS22HHSensor.cpp.

int get_temp_drdy_status ( uint8_t *  status )

Get the LPS22HH temperature data ready bit value.

Parameters:
statusthe status of data ready bit
Return values:
0in case of success, an error code otherwise

Definition at line 365 of file LPS22HHSensor.cpp.

int get_temperature ( float *  value ) [virtual]

Get the LPS22HH temperature value.

Parameters:
valuepointer where the temperature value is written
Return values:
0in case of success, an error code otherwise

Definition at line 346 of file LPS22HHSensor.cpp.

int init ( void *  init ) [virtual]

Initializing the component.

Parameters:
initpointer to device specific initalization structure
Return values:
0in case of success, an error code otherwise

Definition at line 96 of file LPS22HHSensor.cpp.

uint8_t io_read ( uint8_t *  pBuffer,
uint8_t  RegisterAddr,
uint16_t  NumByteToRead 
)

Utility function to read data.

Parameters:
pBuffer,:pointer to data to be read.
RegisterAddr,:specifies internal address register to be read.
NumByteToRead,:number of bytes to be read.
Return values:
0if ok, an error code otherwise.

Definition at line 128 of file LPS22HHSensor.h.

uint8_t io_write ( uint8_t *  pBuffer,
uint8_t  RegisterAddr,
uint16_t  NumByteToWrite 
)

Utility function to write data.

Parameters:
pBuffer,:pointer to data to be written.
RegisterAddr,:specifies internal address register to be written.
NumByteToWrite,:number of bytes to write.
Return values:
0if ok, an error code otherwise.

Definition at line 161 of file LPS22HHSensor.h.

int read_id ( uint8_t *  id ) [virtual]

Get WHO_AM_I value.

Parameters:
idthe WHO_AM_I value
Return values:
0in case of success, an error code otherwise

Definition at line 134 of file LPS22HHSensor.cpp.

int read_reg ( uint8_t  reg,
uint8_t *  data 
)

Get the LPS22HH register value.

Parameters:
regaddress to be written
datavalue to be written
Return values:
0in case of success, an error code otherwise

Definition at line 380 of file LPS22HHSensor.cpp.

int reset_fifo_interrupt ( uint8_t  interrupt )

Reset the FIFO interrupt.

Parameters:
interruptThe FIFO interrupt to be reset; values: 0 = FTH; 1 = FULL; 2 = OVR
Return values:
0in case of success, an error code otherwise

Definition at line 493 of file LPS22HHSensor.cpp.

int set_fifo_interrupt ( uint8_t  interrupt )

Set the FIFO interrupt.

Parameters:
interruptThe FIFO interrupt to be set; values: 0 = FTH; 1 = FULL; 2 = OVR
Return values:
0in case of success, an error code otherwise

Definition at line 523 of file LPS22HHSensor.cpp.

int set_fifo_mode ( uint8_t  mode )

Set the FIFO mode.

Parameters:
Modethe FIFO mode to be set
Return values:
0in case of success, an error code otherwise

Definition at line 553 of file LPS22HHSensor.cpp.

int set_fifo_watermark_level ( uint8_t  watermark )

Set the LPS22HH FIFO watermark level.

Parameters:
watermarkthe FIFO watermark level to be set
Return values:
0in case of success, an error code otherwise

Definition at line 580 of file LPS22HHSensor.cpp.

int set_odr ( float  odr )

Set the LPS22HH pressure sensor output data rate.

Parameters:
odrthe output data rate value to be set
Return values:
0in case of success, an error code otherwise

Definition at line 251 of file LPS22HHSensor.cpp.

int set_one_shot (  )

Set the LPS22HH One Shot Mode.

Return values:
0in case of success, an error code otherwise

Definition at line 607 of file LPS22HHSensor.cpp.

int stop_fifo_on_watermark ( uint8_t  stop )

Set the LPS22HH stop on watermark function.

Parameters:
stopthe state of stop on watermark function
Return values:
0in case of success, an error code otherwise

Definition at line 594 of file LPS22HHSensor.cpp.

int write_reg ( uint8_t  reg,
uint8_t  data 
)

Set the LPS22HH register value.

Parameters:
regaddress to be written
datavalue to be written
Return values:
0in case of success, an error code otherwise

Definition at line 395 of file LPS22HHSensor.cpp.