Skip to content

Offline mode add missing drivers 2025 04 04 #739

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
May 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/build-clang-doxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,6 @@ jobs:
run: |
git clone --quiet https://github.com/pstolarz/OneWireNg.git /home/runner/Arduino/libraries/OneWireNg
git clone --quiet https://github.com/pstolarz/Arduino-Temperature-Control-Library.git /home/runner/Arduino/libraries/Arduino-Temperature-Control-Library
git clone --quiet https://github.com/brentru/Adafruit_SPIFlash.git /home/runner/Arduino/libraries/Adafruit_SPIFlash
git clone --quiet https://github.com/adafruit/Adafruit_TinyUSB_Arduino /home/runner/Arduino/libraries/Adafruit_TinyUSB_Arduino
- name: Download stable Nanopb
id: download-nanopb
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Pre-compiled binaries and UF2 files for supported hardware are provided on the [
|--|--|
|[ESP32-x](https://github.com/espressif/arduino-esp32)| ESP32, ESP32-S2, ESP32-S3, ESP32-C3, ESP32-C6 |
|[ESP8266](https://github.com/esp8266/Arduino)| ESP8266 |
|[RP2040](https://github.com/earlephilhower/arduino-pico)| RP2040 MCU w/WiFi (i.e: Pico W) |
|[RP2](https://github.com/earlephilhower/arduino-pico)| RP2040/RP2350 MCU w/WiFi (i.e: Pico W) |
|[ATSAMD](https://github.com/adafruit/ArduinoCore-samd/)| SAMD51 MCU w/separate WiFi Co-Processor (i.e: Adafruit "AirLift")|

## Contributing to Adafruit.io and WipperSnapper
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ paragraph=Arduino application for Adafruit.io WipperSnapper
category=Communication
url=https://github.com/adafruit/Adafruit_Wippersnapper_Arduino
architectures=*
depends=SdFat - Adafruit Fork, Adafruit SPIFlash, Adafruit NeoPixel, ArduinoJson, Adafruit DotStar, Adafruit HDC302x, Adafruit INA219, Adafruit LTR329 and LTR303, Adafruit LTR390 Library, Adafruit MCP3421, 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, RTClib, StreamUtils, Adafruit SHT4x Library
depends=SdFat - Adafruit Fork, Adafruit SPIFlash, Adafruit NeoPixel, ArduinoJson, Adafruit DotStar, Adafruit HDC302x, Adafruit INA219, Adafruit INA260 Library, Adafruit LTR329 and LTR303, Adafruit LTR390 Library, Adafruit MCP3421, 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, RTClib, StreamUtils, Adafruit SHT4x Library
9 changes: 6 additions & 3 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ lib_deps =
adafruit/Adafruit DPS310
adafruit/Adafruit DS248x
adafruit/Adafruit INA219
adafruit/Adafruit INA260 Library
adafruit/Adafruit HTS221
adafruit/Adafruit HTU21DF Library
adafruit/Adafruit HTU31D Library
adafruit/Adafruit HDC302x
adafruit/Adafruit LTR390 Library
adafruit/Adafruit LTR329 and LTR303
adafruit/Adafruit PCT2075
Expand All @@ -43,6 +45,7 @@ lib_deps =
adafruit/Adafruit Si7021 Library
adafruit/Adafruit VCNL4020 Library
adafruit/Adafruit VCNL4040
adafruit/Adafruit VCNL4200 Library
adafruit/Adafruit MCP3421
adafruit/Adafruit MCP9808 Library
adafruit/Adafruit MCP9600 Library
Expand All @@ -61,6 +64,7 @@ lib_deps =
adafruit/Adafruit VEML7700 Library
adafruit/Adafruit LC709203F
adafruit/Adafruit LPS2X
adafruit/Adafruit LPS28
adafruit/Adafruit LPS35HW
adafruit/Adafruit seesaw Library
adafruit/Adafruit BME680 Library
Expand All @@ -76,6 +80,7 @@ lib_deps =
https://github.com/pstolarz/OneWireNg.git
https://github.com/Sensirion/arduino-sht.git
https://github.com/Sensirion/arduino-i2c-sen5x.git
https://github.com/Sensirion/arduino-i2c-sen66.git
https://github.com/adafruit/WiFiNINA.git
https://github.com/Starmbi/hp_BH1750.git
https://github.com/adafruit/RTClib.git
Expand All @@ -84,9 +89,7 @@ lib_deps =

; Common build environment for ESP32 platform
[common:esp32]
; platform = https://github.com/pioarduino/platform-espressif32/releases/download/51.03.03/platform-espressif32.zip
; platform = https://github.com/pioarduino/platform-espressif32#develop
platform = https://github.com/pioarduino/platform-espressif32/releases/download/51.03.07/platform-espressif32.zip
platform = https://github.com/pioarduino/platform-espressif32/releases/download/54.03.20/platform-espressif32.zip
lib_ignore = WiFiNINA, WiFi101
monitor_filters = esp32_exception_decoder, time
; upload_speed = 921600
Expand Down
76 changes: 70 additions & 6 deletions src/components/i2c/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,26 @@ static const std::map<std::string, FnCreateI2CDriver> I2cFactory = {
const char *driver_name) -> drvBase * {
return new drvHtu21d(i2c, addr, mux_channel, driver_name);
}},
{"htu31d",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvHtu31d(i2c, addr, mux_channel, driver_name);
}},
{"hdc302x",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvHdc302x(i2c, addr, mux_channel, driver_name);
}},
{"ina219",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvIna219(i2c, addr, mux_channel, driver_name);
}},
{"ina260",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvIna260(i2c, addr, mux_channel, driver_name);
}},
{"lc709203f",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
Expand All @@ -148,6 +163,11 @@ static const std::map<std::string, FnCreateI2CDriver> I2cFactory = {
const char *driver_name) -> drvBase * {
return new drvLps25hb(i2c, addr, mux_channel, driver_name);
}},
{"lps28dfw",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvLps28dfw(i2c, addr, mux_channel, driver_name);
}},
{"ltr329",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
Expand Down Expand Up @@ -223,6 +243,11 @@ static const std::map<std::string, FnCreateI2CDriver> I2cFactory = {
const char *driver_name) -> drvBase * {
return new drvScd30(i2c, addr, mux_channel, driver_name);
}},
{"sgp30",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvSgp30(i2c, addr, mux_channel, driver_name);
}},
{"sgp40",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
Expand Down Expand Up @@ -278,6 +303,36 @@ static const std::map<std::string, FnCreateI2CDriver> I2cFactory = {
const char *driver_name) -> drvBase * {
return new drvSen5x(i2c, addr, mux_channel, driver_name);
}},
{"sen60",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvSen6x(i2c, addr, mux_channel, driver_name);
}},
{"sen63c",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvSen6x(i2c, addr, mux_channel, driver_name);
}},
{"sen65",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvSen6x(i2c, addr, mux_channel, driver_name);
}},
{"sen66",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvSen6x(i2c, addr, mux_channel, driver_name);
}},
{"sen68",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvSen6x(i2c, addr, mux_channel, driver_name);
}},
{"sen6x",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvSen6x(i2c, addr, mux_channel, driver_name);
}},
{"shtc3",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
Expand Down Expand Up @@ -318,6 +373,11 @@ static const std::map<std::string, FnCreateI2CDriver> I2cFactory = {
const char *driver_name) -> drvBase * {
return new drvVncl4040(i2c, addr, mux_channel, driver_name);
}},
{"vncl4200",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvVncl4200(i2c, addr, mux_channel, driver_name);
}},
{"vl53l0x",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
Expand Down Expand Up @@ -365,10 +425,12 @@ static const std::unordered_map<uint16_t, std::vector<const char *>>
{0x2A, {"nau7802"}},
{0x38, {"aht20", "max17048"}},
{0x39, {"tsl2591"}},
{0x40, {"htu21d", "ina219", "ms8607", "si7021", "stemma_soil"}},
{0x41, {"ina219"}},
{0x44, {"sht3x", "sht4x"}},
{0x45, {"sht3x"}},
{0x40, {"htu21d", "htu31d", "ina219", "ina260", "ms8607", "si7021", "stemma_soil"}},
{0x41, {"htu31d", "ina219", "ina260"}},
{0x44, {"hdc302x", "ina260", "sht3x", "sht4x"}},
{0x45, {"hdc302x", "ina260", "sht3x"}},
{0x46, {"hdc302x"}},
{0x47, {"hdc302x"}},
{0x48, {"adt7410", "pct2075", "tmp117"}},
{0x49, {"adt7410", "pct2075", "tmp117", "tsl2591"}},
{0x4A, {"adt7410", "pct2075", "tmp117"}},
Expand All @@ -377,17 +439,19 @@ static const std::unordered_map<uint16_t, std::vector<const char *>>
{0x4D, {"pct2075"}},
{0x4E, {"pct2075"}},
{0x4F, {"pct2075"}},
{0x51, {"vcnl4200"}},
{0x52, {"ens160"}},
{0x53, {"ens160", "ltr390"}},
{0x59, {"sgp40"}},
{0x5C, {"bh1750", "lps22hb", "lps25hb"}},
{0x5D, {"lps22hb", "lps25hb"}},
{0x5C, {"bh1750", "lps22hb", "lps25hb", "lps28dfw"}},
{0x5D, {"lps22hb", "lps25hb", "lps28dfw"}},
{0x5F, {"hts2221"}},
{0x60, {"mpl115a2", "vncl4040"}},
{0x61, {"scd30"}},
{0x62, {"scd40"}},
{0x68, {"mcp3421"}},
{0x69, {"sen50"}},
{0x6B, {"sen66"}},
{0x70, {"pct2075", "shtc3"}},
{0x71, {"pct2075"}},
{0x72, {"pct2075"}},
Expand Down
7 changes: 7 additions & 0 deletions src/components/i2c/controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,16 @@
#include "drivers/drvDps310.h"
#include "drivers/drvDs2484.h"
#include "drivers/drvEns160.h"
#include "drivers/drvHdc302x.h"
#include "drivers/drvHts221.h"
#include "drivers/drvHtu21d.h"
#include "drivers/drvHtu31d.h"
#include "drivers/drvIna219.h"
#include "drivers/drvIna260.h"
#include "drivers/drvLc709203f.h"
#include "drivers/drvLps22hb.h"
#include "drivers/drvLps25hb.h"
#include "drivers/drvLps28dfw.h"
#include "drivers/drvLps3xhw.h"
#include "drivers/drvLtr329_Ltr303.h"
#include "drivers/drvLtr390.h"
Expand All @@ -50,6 +54,8 @@
#include "drivers/drvScd30.h"
#include "drivers/drvScd4x.h"
#include "drivers/drvSen5x.h"
#include "drivers/drvSen6x.h"
#include "drivers/drvSgp30.h"
#include "drivers/drvSgp40.h"
#include "drivers/drvSht3x.h"
#include "drivers/drvSht4x.h"
Expand All @@ -66,6 +72,7 @@
#include "drivers/drvVl6180x.h"
#include "drivers/drvVncl4020.h"
#include "drivers/drvVncl4040.h"
#include "drivers/drvVncl4200.h"

#define SCAN_DEVICE \
"UNKNOWN_SCAN" ///< Name for I2C devices found by an i2c scan
Expand Down
133 changes: 133 additions & 0 deletions src/components/i2c/drivers/drvHdc302x.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
/*!
* @file drvHdc302x.h
*
* Device driver for an HDC302X Humidity and Temperature sensor.
*/

#ifndef DRV_HDC302X_H
#define DRV_HDC302X_H

#include "drvBase.h"
#include <Adafruit_HDC302x.h>

/**************************************************************************/
/*!
@brief Class that provides a sensor driver for the HDC302X humidity and
temperature sensor. This implementation uses the 1 Hz data rate.
*/
/**************************************************************************/
class drvHdc302x : public drvBase {

public:
/*******************************************************************************/
/*!
@brief Constructor for an HDC302X sensor.
@param i2c
The I2C interface.
@param sensorAddress
7-bit device address.
@param mux_channel
The I2C multiplexer channel.
@param driver_name
The name of the driver.
*/
/*******************************************************************************/
drvHdc302x(TwoWire *i2c, uint16_t sensorAddress, uint32_t mux_channel,
const char *driver_name)
: drvBase(i2c, sensorAddress, mux_channel, driver_name) {
// Initialization handled by drvBase constructor
}

/*******************************************************************************/
/*!
@brief Destructor for an HDC302X sensor.
*/
/*******************************************************************************/
~drvHdc302x() { delete _hdc302x; }

/*******************************************************************************/
/*!
@brief Initializes the HDC302X sensor and begins I2C.
@returns True if initialized successfully, False otherwise.
*/
/*******************************************************************************/
bool begin() {
// attempt to initialize the HDC302X using the I2C interface
_hdc302x = new Adafruit_HDC302x();
if (!_hdc302x->begin(_address, _i2c))
return false;

// set the HDC302X's data rate to 1 Hz lowest noise
_hdc302x->setAutoMode(EXIT_AUTO_MODE);
// discard first reading (It returned -45c for me once)
_hdc302x->readTemperatureHumidityOnDemand(_temp, _humidity,
TRIGGERMODE_LP0);
return true;
}

/*******************************************************************************/
/*!
@brief Reads the HDC302X's temperature and humidity data.
@returns True if the data was read successfully, False otherwise.
*/
/*******************************************************************************/
bool ReadSensorData() {
uint16_t status = _hdc302x->readStatus();
if (status & 0x0010) {
WS_DEBUG_PRINTLN(F("Device Reset Detected"));
return false;
}

if (status & 0x0001) {
WS_DEBUG_PRINTLN(
F("Checksum Verification Fail (incorrect checksum received)"));
return false;
}

if (!_hdc302x->readTemperatureHumidityOnDemand(_temp, _humidity,
TRIGGERMODE_LP0)) {
WS_DEBUG_PRINTLN(F("Failed to read temperature and humidity."));
return false;
}
return true;
}

/*******************************************************************************/
/*!
@brief Gets the HDC302X'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 (ReadSensorData() == false)
return false;
tempEvent->temperature = _temp;
return true;
}

/*******************************************************************************/
/*!
@brief Gets the HDC302X's current humidity.
@param humidEvent
Pointer to an Adafruit_Sensor event.
@returns True if the humidity was obtained successfully, False
otherwise.
*/
/*******************************************************************************/
bool getEventRelativeHumidity(sensors_event_t *humidEvent) {
if (ReadSensorData() == false)
return false;
humidEvent->relative_humidity = _humidity;
return true;
}

protected:
Adafruit_HDC302x *_hdc302x; ///< Pointer to an HDC302X object
double _temp = 0.0; ///< Holds data for the HDC302X's temperature sensor
double _humidity = 0.0; ///< Holds data for the HDC302X's humidity sensor
};
#endif // DRV_HDC302X_H
Loading
Loading