Compare commits
5 commits
main
...
add-bmp581
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
72b895599c | ||
|
|
7898c26a1c | ||
|
|
8e803d12e8 | ||
|
|
905db7a475 | ||
|
|
4b65a345da |
5 changed files with 157 additions and 3 deletions
|
|
@ -7,4 +7,4 @@ paragraph=Arduino application for Adafruit.io WipperSnapper
|
||||||
category=Communication
|
category=Communication
|
||||||
url=https://github.com/adafruit/Adafruit_Wippersnapper_Arduino
|
url=https://github.com/adafruit/Adafruit_Wippersnapper_Arduino
|
||||||
architectures=*
|
architectures=*
|
||||||
depends=OmronD6T - Community Fork, SdFat - Adafruit Fork, Adafruit NeoPixel, Adafruit SPIFlash, ArduinoJson, Adafruit DotStar, Adafruit HDC302x, Adafruit INA219, Adafruit INA260 Library, Adafruit INA237 and INA238 Library, Adafruit LTR329 and LTR303, Adafruit LTR390 Library, Adafruit MCP3421, Adafruit MLX90632 Library, Adafruit NAU7802 Library, Adafruit SleepyDog Library, Adafruit TMP117, Adafruit TinyUSB Library, Adafruit AHTX0, Adafruit BME280 Library, Adafruit BMP280 Library, Adafruit BMP3XX Library, Adafruit DPS310, Adafruit DS248x, Adafruit SCD30, Adafruit SGP30 Sensor, Adafruit SGP40 Sensor, Sensirion I2C SCD4x, Sensirion I2C SEN5X, Sensirion I2C SEN66, arduino-sht, Adafruit Si7021 Library, Adafruit MQTT Library, Adafruit MS8607, Adafruit MCP9808 Library, Adafruit MCP9600 Library, Adafruit MPL115A2, Adafruit MPRLS Library, Adafruit TSL2591 Library, Adafruit_VL53L0X, Adafruit VL53L1X, STM32duino VL53L4CD, STM32duino VL53L4CX, Adafruit_VL6180X, Adafruit PM25 AQI Sensor, Adafruit VCNL4020 Library, Adafruit VCNL4040, Adafruit VCNL4200 Library, Adafruit VEML7700 Library, Adafruit LC709203F, Adafruit LPS2X, Adafruit LPS28, Adafruit LPS35HW, Adafruit seesaw Library, Adafruit BME680 Library, Adafruit MAX1704X, Adafruit ADT7410 Library, Adafruit HTS221, Adafruit HTU21DF Library, Adafruit HTU31D Library, Adafruit PCT2075, hp_BH1750, ENS160 - Adafruit Fork, Adafruit BusIO, Adafruit Unified Sensor, Sensirion Core, Adafruit GFX Library, Adafruit LED Backpack Library, Adafruit LiquidCrystal, Adafruit SH110X, Adafruit SSD1306
|
depends=OmronD6T - Community Fork, SdFat - Adafruit Fork, Adafruit NeoPixel, Adafruit SPIFlash, ArduinoJson, Adafruit DotStar, Adafruit HDC302x, Adafruit INA219, Adafruit INA260 Library, Adafruit INA237 and INA238 Library, Adafruit LTR329 and LTR303, Adafruit LTR390 Library, Adafruit MCP3421, Adafruit MLX90632 Library, Adafruit NAU7802 Library, Adafruit SleepyDog Library, Adafruit TMP117, Adafruit TinyUSB Library, Adafruit AHTX0, Adafruit BME280 Library, Adafruit BMP280 Library, Adafruit BMP3XX Library, Adafruit BMP5xx Library, Adafruit DPS310, Adafruit DS248x, Adafruit SCD30, Adafruit SGP30 Sensor, Adafruit SGP40 Sensor, Sensirion I2C SCD4x, Sensirion I2C SEN5X, Sensirion I2C SEN66, arduino-sht, Adafruit Si7021 Library, Adafruit MQTT Library, Adafruit MS8607, Adafruit MCP9808 Library, Adafruit MCP9600 Library, Adafruit MPL115A2, Adafruit MPRLS Library, Adafruit TSL2591 Library, Adafruit_VL53L0X, Adafruit VL53L1X, STM32duino VL53L4CD, STM32duino VL53L4CX, Adafruit_VL6180X, Adafruit PM25 AQI Sensor, Adafruit VCNL4020 Library, Adafruit VCNL4040, Adafruit VCNL4200 Library, Adafruit VEML7700 Library, Adafruit LC709203F, Adafruit LPS2X, Adafruit LPS28, Adafruit LPS35HW, Adafruit seesaw Library, Adafruit BME680 Library, Adafruit MAX1704X, Adafruit ADT7410 Library, Adafruit HTS221, Adafruit HTU21DF Library, Adafruit HTU31D Library, Adafruit PCT2075, hp_BH1750, ENS160 - Adafruit Fork, Adafruit BusIO, Adafruit Unified Sensor, Sensirion Core, Adafruit GFX Library, Adafruit LED Backpack Library, Adafruit LiquidCrystal, Adafruit SH110X, Adafruit SSD1306
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ lib_deps =
|
||||||
adafruit/Adafruit BME280 Library
|
adafruit/Adafruit BME280 Library
|
||||||
adafruit/Adafruit BMP280 Library
|
adafruit/Adafruit BMP280 Library
|
||||||
adafruit/Adafruit BMP3XX Library
|
adafruit/Adafruit BMP3XX Library
|
||||||
|
adafruit/Adafruit BMP5XX Library
|
||||||
adafruit/Adafruit DPS310
|
adafruit/Adafruit DPS310
|
||||||
adafruit/Adafruit DS248x
|
adafruit/Adafruit DS248x
|
||||||
adafruit/Adafruit INA219
|
adafruit/Adafruit INA219
|
||||||
|
|
|
||||||
|
|
@ -272,14 +272,27 @@ bool WipperSnapper_Component_I2C::initI2CDevice(
|
||||||
(strcmp("bmp390", msgDeviceInitReq->i2c_device_name) == 0)) {
|
(strcmp("bmp390", msgDeviceInitReq->i2c_device_name) == 0)) {
|
||||||
_bmp3xx = new WipperSnapper_I2C_Driver_BMP3XX(this->_i2c, i2cAddress);
|
_bmp3xx = new WipperSnapper_I2C_Driver_BMP3XX(this->_i2c, i2cAddress);
|
||||||
if (!_bmp3xx->begin()) {
|
if (!_bmp3xx->begin()) {
|
||||||
WS_DEBUG_PRINTLN("ERROR: Failed to initialize BMP388!");
|
WS_DEBUG_PRINTLN("ERROR: Failed to initialize BMP3xx!");
|
||||||
_busStatusResponse =
|
_busStatusResponse =
|
||||||
wippersnapper_i2c_v1_BusResponse_BUS_RESPONSE_DEVICE_INIT_FAIL;
|
wippersnapper_i2c_v1_BusResponse_BUS_RESPONSE_DEVICE_INIT_FAIL;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_bmp3xx->configureDriver(msgDeviceInitReq);
|
_bmp3xx->configureDriver(msgDeviceInitReq);
|
||||||
drivers.push_back(_bmp3xx);
|
drivers.push_back(_bmp3xx);
|
||||||
WS_DEBUG_PRINTLN("BMP388 Initialized Successfully!");
|
WS_DEBUG_PRINTLN("BMP3xx Initialized Successfully!");
|
||||||
|
} else if ((strcmp("bmp580", msgDeviceInitReq->i2c_device_name) == 0) ||
|
||||||
|
(strcmp("bmp581", msgDeviceInitReq->i2c_device_name) == 0) ||
|
||||||
|
(strcmp("bmp585", msgDeviceInitReq->i2c_device_name) == 0)) {
|
||||||
|
_bmp5xx = new WipperSnapper_I2C_Driver_BMP5XX(this->_i2c, i2cAddress);
|
||||||
|
if (!_bmp5xx->begin()) {
|
||||||
|
WS_DEBUG_PRINTLN("ERROR: Failed to initialize BMP5xx!");
|
||||||
|
_busStatusResponse =
|
||||||
|
wippersnapper_i2c_v1_BusResponse_BUS_RESPONSE_DEVICE_INIT_FAIL;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
_bmp5xx->configureDriver(msgDeviceInitReq);
|
||||||
|
drivers.push_back(_bmp5xx);
|
||||||
|
WS_DEBUG_PRINTLN("BMP5xx Initialized Successfully!");
|
||||||
} else if ((strcmp("bme680", msgDeviceInitReq->i2c_device_name) == 0) ||
|
} else if ((strcmp("bme680", msgDeviceInitReq->i2c_device_name) == 0) ||
|
||||||
(strcmp("bme688", msgDeviceInitReq->i2c_device_name) == 0)) {
|
(strcmp("bme688", msgDeviceInitReq->i2c_device_name) == 0)) {
|
||||||
_bme680 = new WipperSnapper_I2C_Driver_BME680(this->_i2c, i2cAddress);
|
_bme680 = new WipperSnapper_I2C_Driver_BME680(this->_i2c, i2cAddress);
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
#include "drivers/WipperSnapper_I2C_Driver_BME680.h"
|
#include "drivers/WipperSnapper_I2C_Driver_BME680.h"
|
||||||
#include "drivers/WipperSnapper_I2C_Driver_BMP280.h"
|
#include "drivers/WipperSnapper_I2C_Driver_BMP280.h"
|
||||||
#include "drivers/WipperSnapper_I2C_Driver_BMP3XX.h"
|
#include "drivers/WipperSnapper_I2C_Driver_BMP3XX.h"
|
||||||
|
#include "drivers/WipperSnapper_I2C_Driver_BMP5XX.h"
|
||||||
#include "drivers/WipperSnapper_I2C_Driver_D6T1A.h"
|
#include "drivers/WipperSnapper_I2C_Driver_D6T1A.h"
|
||||||
#include "drivers/WipperSnapper_I2C_Driver_DPS310.h"
|
#include "drivers/WipperSnapper_I2C_Driver_DPS310.h"
|
||||||
#include "drivers/WipperSnapper_I2C_Driver_DS2484.h"
|
#include "drivers/WipperSnapper_I2C_Driver_DS2484.h"
|
||||||
|
|
@ -167,6 +168,7 @@ private:
|
||||||
WipperSnapper_I2C_Driver_BME280 *_bme280 = nullptr;
|
WipperSnapper_I2C_Driver_BME280 *_bme280 = nullptr;
|
||||||
WipperSnapper_I2C_Driver_BMP280 *_bmp280 = nullptr;
|
WipperSnapper_I2C_Driver_BMP280 *_bmp280 = nullptr;
|
||||||
WipperSnapper_I2C_Driver_BMP3XX *_bmp3xx = nullptr;
|
WipperSnapper_I2C_Driver_BMP3XX *_bmp3xx = nullptr;
|
||||||
|
WipperSnapper_I2C_Driver_BMP5XX *_bmp5xx = nullptr;
|
||||||
WipperSnapper_I2C_Driver_BME680 *_bme680 = nullptr;
|
WipperSnapper_I2C_Driver_BME680 *_bme680 = nullptr;
|
||||||
WipperSnapper_I2C_Driver_HDC302X *_hdc302x = nullptr;
|
WipperSnapper_I2C_Driver_HDC302X *_hdc302x = nullptr;
|
||||||
WipperSnapper_I2C_Driver_HTS221 *_hts221 = nullptr;
|
WipperSnapper_I2C_Driver_HTS221 *_hts221 = nullptr;
|
||||||
|
|
|
||||||
138
src/components/i2c/drivers/WipperSnapper_I2C_Driver_BMP5XX.h
Normal file
138
src/components/i2c/drivers/WipperSnapper_I2C_Driver_BMP5XX.h
Normal file
|
|
@ -0,0 +1,138 @@
|
||||||
|
/*!
|
||||||
|
* @file WipperSnapper_I2C_Driver_BMP5XX.h
|
||||||
|
*
|
||||||
|
* Device driver for a BMP5XX precision pressure sensor breakout.
|
||||||
|
*
|
||||||
|
* Adafruit invests time and resources providing this open source code,
|
||||||
|
* please support Adafruit and open-source hardware by purchasing
|
||||||
|
* products from Adafruit!
|
||||||
|
*
|
||||||
|
* Copyright (c) Tyeth Gundry 2025 for Adafruit Industries.
|
||||||
|
*
|
||||||
|
* MIT license, all text here must be included in any redistribution.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef WipperSnapper_I2C_Driver_BMP5XX_H
|
||||||
|
#define WipperSnapper_I2C_Driver_BMP5XX_H
|
||||||
|
|
||||||
|
#include <Adafruit_BMP5xx.h>
|
||||||
|
|
||||||
|
#include "WipperSnapper_I2C_Driver.h"
|
||||||
|
|
||||||
|
#define SEALEVELPRESSURE_HPA (1013.25) ///< Default sea level pressure, in hPa
|
||||||
|
|
||||||
|
/**************************************************************************/
|
||||||
|
/*!
|
||||||
|
@brief Class that provides a sensor driver for the BMP5XX temperature
|
||||||
|
and pressure sensor.
|
||||||
|
*/
|
||||||
|
/**************************************************************************/
|
||||||
|
class WipperSnapper_I2C_Driver_BMP5XX : public WipperSnapper_I2C_Driver {
|
||||||
|
public:
|
||||||
|
/*******************************************************************************/
|
||||||
|
/*!
|
||||||
|
@brief Constructor for an BMP5XX sensor.
|
||||||
|
@param i2c
|
||||||
|
The I2C interface.
|
||||||
|
@param sensorAddress
|
||||||
|
7-bit device address.
|
||||||
|
*/
|
||||||
|
/*******************************************************************************/
|
||||||
|
WipperSnapper_I2C_Driver_BMP5XX(TwoWire *i2c, uint16_t sensorAddress)
|
||||||
|
: WipperSnapper_I2C_Driver(i2c, sensorAddress) {
|
||||||
|
_bmp5xx = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************/
|
||||||
|
/*!
|
||||||
|
@brief Destructor for an BMP5XX sensor.
|
||||||
|
*/
|
||||||
|
/*******************************************************************************/
|
||||||
|
~WipperSnapper_I2C_Driver_BMP5XX() {
|
||||||
|
if (_bmp5xx) {
|
||||||
|
delete _bmp5xx;
|
||||||
|
_bmp5xx = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************/
|
||||||
|
/*!
|
||||||
|
@brief Initializes the BMP5XX sensor and begins I2C.
|
||||||
|
@returns True if initialized successfully, False otherwise.
|
||||||
|
*/
|
||||||
|
/*******************************************************************************/
|
||||||
|
bool begin() {
|
||||||
|
_bmp5xx = new Adafruit_BMP5xx();
|
||||||
|
if (!_bmp5xx->begin(_sensorAddress, _i2c)) {
|
||||||
|
delete _bmp5xx;
|
||||||
|
_bmp5xx = nullptr;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set up oversampling and filter initialization
|
||||||
|
_bmp5xx->setTemperatureOversampling(BMP5XX_OVERSAMPLING_8X);
|
||||||
|
_bmp5xx->setPressureOversampling(BMP5XX_OVERSAMPLING_4X);
|
||||||
|
_bmp5xx->setIIRFilterCoeff(BMP5XX_IIR_FILTER_COEFF_3);
|
||||||
|
_bmp5xx->setOutputDataRate(BMP5XX_ODR_50_HZ);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************/
|
||||||
|
/*!
|
||||||
|
@brief Gets the BMP5XX's current temperature.
|
||||||
|
@param tempEvent
|
||||||
|
Pointer to an Adafruit_Sensor event.
|
||||||
|
@returns True if the temperature was obtained successfully, False
|
||||||
|
otherwise.
|
||||||
|
*/
|
||||||
|
/*******************************************************************************/
|
||||||
|
bool getEventAmbientTemp(sensors_event_t *tempEvent) {
|
||||||
|
if (!_bmp5xx->performReading()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
tempEvent->temperature = _bmp5xx->temperature;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************/
|
||||||
|
/*!
|
||||||
|
@brief Reads a pressure sensor and converts
|
||||||
|
the reading into the expected SI unit.
|
||||||
|
@param pressureEvent
|
||||||
|
Pointer to an Adafruit_Sensor event.
|
||||||
|
@returns True if the sensor event was obtained successfully, False
|
||||||
|
otherwise.
|
||||||
|
*/
|
||||||
|
/*******************************************************************************/
|
||||||
|
bool getEventPressure(sensors_event_t *pressureEvent) {
|
||||||
|
if (!_bmp5xx->performReading()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
pressureEvent->pressure = _bmp5xx->pressure;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************/
|
||||||
|
/*!
|
||||||
|
@brief Reads a the BMP5XX's altitude sensor into an event.
|
||||||
|
@param altitudeEvent
|
||||||
|
Pointer to an adafruit sensor event.
|
||||||
|
@returns True if the sensor event was obtained successfully, False
|
||||||
|
otherwise.
|
||||||
|
*/
|
||||||
|
/*******************************************************************************/
|
||||||
|
bool getEventAltitude(sensors_event_t *altitudeEvent) {
|
||||||
|
if (!_bmp5xx->performReading()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
altitudeEvent->altitude = _bmp5xx->readAltitude(SEALEVELPRESSURE_HPA);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
Adafruit_BMP5xx *_bmp5xx; ///< BMP5xx object
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // WipperSnapper_I2C_Driver_BMP5XX
|
||||||
Loading…
Reference in a new issue