18 #ifndef _ADAFRUIT_LPS2X_H 19 #define _ADAFRUIT_LPS2X_H 22 #include <Adafruit_BusIO_Register.h> 23 #include <Adafruit_I2CDevice.h> 24 #include <Adafruit_Sensor.h> 27 #define LPS2X_I2CADDR_DEFAULT 0x5D 28 #define LPS2X_WHOAMI 0x0F 30 #define LPS22HB_CHIP_ID 0xB1 31 #define LPS22_THS_P_L_REG 0x0C 32 #define LPS22_CTRL_REG1 0x10 33 #define LPS22_CTRL_REG2 0x11 34 #define LPS22_CTRL_REG3 \ 37 #define LPS25HB_CHIP_ID 0xBD 38 #define LPS25_CTRL_REG1 0x20 39 #define LPS25_CTRL_REG2 0x21 40 #define LPS25_CTRL_REG3 \ 42 #define LPS25_CTRL_REG4 \ 44 #define LPS25_INTERRUPT_CFG 0x24 45 #define LPS25_THS_P_L_REG 0xB0 47 #define LPS2X_PRESS_OUT_XL \ 49 #define LPS2X_TEMP_OUT_L (0x2B | 0x80) 105 int _sensorID = 0x26;
119 TwoWire *wire = &Wire, int32_t sensor_id = 0);
121 bool begin_SPI(uint8_t cs_pin, SPIClass *theSPI = &SPI,
122 int32_t sensor_id = 0);
123 bool begin_SPI(int8_t cs_pin, int8_t sck_pin, int8_t miso_pin,
124 int8_t mosi_pin, int32_t sensor_id = 0);
126 void setPresThreshold(uint16_t hPa_delta);
127 bool getEvent(sensors_event_t *pressure, sensors_event_t *temp);
130 Adafruit_Sensor *getTemperatureSensor(
void);
131 Adafruit_Sensor *getPressureSensor(
void);
137 virtual bool _init(int32_t sensor_id) = 0;
144 uint16_t _sensorid_pressure,
146 float temp_scaling = 1;
147 float temp_offset = 1;
148 uint8_t inc_spi_flag =
150 bool isOneShot =
false;
152 Adafruit_I2CDevice *i2c_dev = NULL;
153 Adafruit_SPIDevice *spi_dev = NULL;
159 Adafruit_BusIO_Register *ctrl1_reg = NULL;
160 Adafruit_BusIO_Register *ctrl2_reg = NULL;
161 Adafruit_BusIO_Register *ctrl3_reg = NULL;
162 Adafruit_BusIO_Register *threshp_reg = NULL;
171 void fillPressureEvent(sensors_event_t *pressure, uint32_t timestamp);
172 void fillTempEvent(sensors_event_t *temp, uint32_t timestamp);
181 void powerDown(
bool power_down);
182 void configureInterrupt(
bool activelow,
bool opendrain,
183 bool pres_high =
false,
bool pres_low =
false);
186 bool _init(int32_t sensor_id);
195 void configureInterrupt(
bool activelow,
bool opendrain,
bool data_ready,
196 bool pres_high =
false,
bool pres_low =
false,
197 bool fifo_full =
false,
bool fifo_watermark =
false,
198 bool fifo_overflow =
false);
201 bool _init(int32_t sensor_id);
lps22_rate_t
Allowed values for setDataRate.
Definition: Adafruit_LPS2X.h:69
bool getEvent(sensors_event_t *)
Gets the temperature as a standard sensor event.
Definition: Adafruit_LPS2X.cpp:332
Class that stores state and functions for interacting with the LPS2X I2C Barometric Pressure & Temper...
Definition: Adafruit_LPS2X.h:113
Adafruit_LPS2X_Pressure(Adafruit_LPS2X *parent)
Create an Adafruit_Sensor compatible object for the pressure sensor.
Definition: Adafruit_LPS2X.h:100
void getSensor(sensor_t *)
Gets the sensor_t data for the LPS2X's tenperature.
Definition: Adafruit_LPS2X.cpp:309
Definition: Adafruit_LPS2X.h:176
float _temp
Last reading's temperature (C)
Definition: Adafruit_LPS2X.h:141
#define LPS2X_I2CADDR_DEFAULT
LPS2X default i2c address.
Definition: Adafruit_LPS2X.h:27
Definition: Adafruit_LPS2X.h:96
lps25_rate_t
Allowed values for setDataRate.
Definition: Adafruit_LPS2X.h:56
uint16_t _sensorid_temp
ID number for temperature.
Definition: Adafruit_LPS2X.h:144
Adafruit_LPS2X_Temp(Adafruit_LPS2X *parent)
Create an Adafruit_Sensor compatible object for the temp sensor.
Definition: Adafruit_LPS2X.h:85
Definition: Adafruit_LPS2X.h:81
Definition: Adafruit_LPS2X.h:190