Adafruit LPS2X Barometric Pressure Sensor Library
Public Member Functions | Protected Member Functions | List of all members
Adafruit_LPS22 Class Reference

#include <Adafruit_LPS2X.h>

Inheritance diagram for Adafruit_LPS22:
Adafruit_LPS2X

Public Member Functions

 ~Adafruit_LPS22 ()
 Destroy the Adafruit_LPS22::Adafruit_LPS22 object.
 
lps22_rate_t getDataRate (void)
 Gets the current rate at which pressure and temperature measurements are taken. More...
 
void setDataRate (lps22_rate_t data_rate)
 Sets the rate at which pressure and temperature measurements. More...
 
void configureInterrupt (bool activelow, bool opendrain, bool data_ready, bool pres_high=false, bool pres_low=false, bool fifo_full=false, bool fifo_watermark=false, bool fifo_overflow=false)
 Configures the INT pin. More...
 
- Public Member Functions inherited from Adafruit_LPS2X
 Adafruit_LPS2X ()
 Construct a new Adafruit_LPS2X::Adafruit_LPS2X object.
 
bool begin_I2C (uint8_t i2c_addr=LPS2X_I2CADDR_DEFAULT, TwoWire *wire=&Wire, int32_t sensor_id=0)
 Sets up the hardware and initializes I2C. More...
 
bool begin_SPI (uint8_t cs_pin, SPIClass *theSPI=&SPI, int32_t sensor_id=0)
 Sets up the hardware and initializes hardware SPI. More...
 
bool begin_SPI (int8_t cs_pin, int8_t sck_pin, int8_t miso_pin, int8_t mosi_pin, int32_t sensor_id=0)
 Sets up the hardware and initializes software SPI. More...
 
void setPresThreshold (uint16_t hPa_delta)
 Set the pressure threshold register for interrupt levels. More...
 
bool getEvent (sensors_event_t *pressure, sensors_event_t *temp)
 Gets the pressure sensor and temperature values as sensor events. More...
 
void reset (void)
 Performs a software reset initializing registers to their power on state.
 
Adafruit_Sensor * getTemperatureSensor (void)
 Gets an Adafruit Unified Sensor object for the temp sensor component. More...
 
Adafruit_Sensor * getPressureSensor (void)
 Gets an Adafruit Unified Sensor object for the presure sensor component. More...
 

Protected Member Functions

bool _init (int32_t sensor_id)
 Initializer for post i2c/spi init. More...
 
- Protected Member Functions inherited from Adafruit_LPS2X
void _read (void)
 Updates the measurement data for all sensors simultaneously.
 

Additional Inherited Members

- Protected Attributes inherited from Adafruit_LPS2X
float _temp
 Last reading's temperature (C)
 
float _pressure
 Last reading's pressure (hPa)
 
uint16_t _sensorid_pressure
 ID number for pressure.
 
uint16_t _sensorid_temp
 ID number for temperature.
 
float temp_scaling = 1
 Different chips have different scalings.
 
float temp_offset = 1
 Different chips have different offsets.
 
uint8_t inc_spi_flag
 If this chip has a bitflag for incrementing SPI registers. More...
 
bool isOneShot = false
 true if data rate is one-shot
 
Adafruit_I2CDevice * i2c_dev = NULL
 Pointer to I2C bus interface.
 
Adafruit_SPIDevice * spi_dev = NULL
 Pointer to SPI bus interface.
 
Adafruit_LPS2X_Temptemp_sensor = NULL
 Temp sensor data object.
 
Adafruit_LPS2X_Pressurepressure_sensor
 Pressure sensor data object. More...
 
Adafruit_BusIO_Register * ctrl1_reg = NULL
 The first control register.
 
Adafruit_BusIO_Register * ctrl2_reg = NULL
 The second control register.
 
Adafruit_BusIO_Register * ctrl3_reg = NULL
 The third control register.
 
Adafruit_BusIO_Register * threshp_reg = NULL
 Pressure threshold.
 

Detailed Description

Specific subclass for LPS22 variant

Member Function Documentation

◆ getDataRate()

lps22_rate_t Adafruit_LPS22::getDataRate ( void  )

Gets the current rate at which pressure and temperature measurements are taken.

Returns
lps22_rate_t The current data rate

◆ setDataRate()

void Adafruit_LPS22::setDataRate ( lps22_rate_t  new_data_rate)

Sets the rate at which pressure and temperature measurements.

Parameters
new_data_rateThe data rate to set. Must be a lps22_rate_t

◆ configureInterrupt()

void Adafruit_LPS22::configureInterrupt ( bool  activelow,
bool  opendrain,
bool  data_ready,
bool  pres_high = false,
bool  pres_low = false,
bool  fifo_full = false,
bool  fifo_watermark = false,
bool  fifo_overflow = false 
)

Configures the INT pin.

Parameters
activelowPass true to make the INT pin drop low on interrupt
opendrainPass true to make the INT pin an open drain output
data_readyIf true, interrupt fires on new data ready
pres_highIf true, interrupt fires on high threshold pass
pres_lowIf true, interrupt fires on low threshold pass
fifo_fullIf true, interrupt fires on fifo full
fifo_watermarkIf true, interrupt fires on fifo watermark pass
fifo_overflowIf true, interrupt fires on fifo overflow

◆ _init()

bool Adafruit_LPS22::_init ( int32_t  sensor_id)
protectedvirtual

Initializer for post i2c/spi init.

Parameters
sensor_idOptional unique ID for the sensor set
Returns
True if chip identified and initialized

Implements Adafruit_LPS2X.


The documentation for this class was generated from the following files: