Class that stores state and functions for interacting with the LPS2X I2C Barometric Pressure & Temperature Sensor.
More...
#include <Adafruit_LPS2X.h>
|
| 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...
|
|
|
virtual bool | _init (int32_t sensor_id)=0 |
| The subclasses' hardware initialization function. More...
|
|
void | _read (void) |
| Updates the measurement data for all sensors simultaneously.
|
|
Class that stores state and functions for interacting with the LPS2X I2C Barometric Pressure & Temperature Sensor.
◆ begin_I2C()
bool Adafruit_LPS2X::begin_I2C |
( |
uint8_t |
i2c_address = LPS2X_I2CADDR_DEFAULT , |
|
|
TwoWire * |
wire = &Wire , |
|
|
int32_t |
sensor_id = 0 |
|
) |
| |
Sets up the hardware and initializes I2C.
- Parameters
-
i2c_address | The I2C address to be used. |
wire | The Wire object to be used for I2C connections. |
sensor_id | The unique ID to differentiate the sensors from others |
- Returns
- True if initialization was successful, otherwise false.
◆ begin_SPI() [1/2]
bool Adafruit_LPS2X::begin_SPI |
( |
uint8_t |
cs_pin, |
|
|
SPIClass * |
theSPI = &SPI , |
|
|
int32_t |
sensor_id = 0 |
|
) |
| |
Sets up the hardware and initializes hardware SPI.
- Parameters
-
cs_pin | The arduino pin # connected to chip select |
theSPI | The SPI object to be used for SPI connections. |
sensor_id | The user-defined ID to differentiate different sensors |
- Returns
- True if initialization was successful, otherwise false.
◆ begin_SPI() [2/2]
bool Adafruit_LPS2X::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.
- Parameters
-
cs_pin | The arduino pin # connected to chip select |
sck_pin | The arduino pin # connected to SPI clock |
miso_pin | The arduino pin # connected to SPI MISO |
mosi_pin | The arduino pin # connected to SPI MOSI |
sensor_id | The user-defined ID to differentiate different sensors |
- Returns
- True if initialization was successful, otherwise false.
◆ setPresThreshold()
void Adafruit_LPS2X::setPresThreshold |
( |
uint16_t |
hPa_delta | ) |
|
Set the pressure threshold register for interrupt levels.
- Parameters
-
hPa_delta | The u16 that will be written to the register, check the datasheet for more info on the format of this value! |
◆ getEvent()
bool Adafruit_LPS2X::getEvent |
( |
sensors_event_t * |
pressure, |
|
|
sensors_event_t * |
temp |
|
) |
| |
Gets the pressure sensor and temperature values as sensor events.
- Parameters
-
pressure | Sensor event object that will be populated with pressure data |
temp | Sensor event object that will be populated with temp data |
- Returns
- True
◆ getTemperatureSensor()
Adafruit_Sensor * Adafruit_LPS2X::getTemperatureSensor |
( |
void |
| ) |
|
Gets an Adafruit Unified Sensor object for the temp sensor component.
- Returns
- Adafruit_Sensor pointer to temperature sensor
◆ getPressureSensor()
Adafruit_Sensor * Adafruit_LPS2X::getPressureSensor |
( |
void |
| ) |
|
Gets an Adafruit Unified Sensor object for the presure sensor component.
- Returns
- Adafruit_Sensor pointer to pressure sensor
◆ _init()
virtual bool Adafruit_LPS2X::_init |
( |
int32_t |
sensor_id | ) |
|
|
protectedpure virtual |
The subclasses' hardware initialization function.
!
- Parameters
-
sensor_id | The unique sensor id we want to assign it |
- Returns
- True on success, false if something went wrong!
Implemented in Adafruit_LPS22, and Adafruit_LPS25.
◆ Adafruit_LPS2X_Temp
Gives access to private members to Temp data object
◆ Adafruit_LPS2X_Pressure
Gives access to private members to Pressure data object
◆ inc_spi_flag
uint8_t Adafruit_LPS2X::inc_spi_flag |
|
protected |
Initial value:
If this chip has a bitflag for incrementing SPI registers.
◆ pressure_sensor
Initial value:
Pressure sensor data object.
The documentation for this class was generated from the following files: