Skip to content
Draft
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
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=OmronD6T - Community Fork, SdFat - Adafruit Fork, Adafruit AS5600 Library, Adafruit NeoPixel, Adafruit SPIFlash, ArduinoJson, Adafruit DotStar, Adafruit HDC302x, Adafruit INA219, Adafruit INA237 and INA238 Library, Adafruit INA260 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 QMC5883P Library, 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, RTClib, StreamUtils, Adafruit SHT4x Library, Adafruit GPS Library, Adafruit uBlox
depends=OmronD6T - Community Fork, SdFat - Adafruit Fork, Adafruit LIS3DH, Adafruit LIS3MDL, Adafruit LSM6DS, Adafruit LSM9DS1 Library, Adafruit LSM303 Accel, Adafruit LSM303DLH Mag, Adafruit LIS2MDL, Adafruit AS5600 Library, Adafruit NeoPixel, Adafruit SPIFlash, ArduinoJson, Adafruit DotStar, Adafruit HDC302x, Adafruit INA219, Adafruit INA237 and INA238 Library, Adafruit INA260 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 QMC5883P Library, 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, RTClib, StreamUtils, Adafruit SHT4x Library, Adafruit GPS Library, Adafruit uBlox
73 changes: 59 additions & 14 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ lib_deps =
adafruit/Adafruit HTS221
adafruit/Adafruit HTU21DF Library
adafruit/Adafruit HTU31D Library
adafruit/Adafruit LIS3DH
adafruit/Adafruit LIS3MDL
adafruit/Adafruit LIS2MDL
adafruit/Adafruit LSM6DS
adafruit/Adafruit LSM9DS1 Library
adafruit/Adafruit LSM303 Accel
adafruit/Adafruit LSM303DLH Mag
adafruit/Adafruit LTR390 Library
adafruit/Adafruit LTR329 and LTR303
adafruit/Adafruit PCT2075
Expand Down Expand Up @@ -111,8 +118,8 @@ lib_deps =

; Common build environment for ESP32 platform
[common:esp32]
platform = https://github.com/pioarduino/platform-espressif32/releases/download/53.03.13/platform-espressif32.zip
lib_ignore = WiFiNINA, WiFi101
platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.33/platform-espressif32.zip
lib_ignore = WiFiNINA, WiFi101, WiFiNINA_-_Adafruit_Fork
monitor_filters = esp32_exception_decoder, time
; upload_speed = 921600

Expand All @@ -139,9 +146,9 @@ board = rpipicow
framework = arduino
board_build.core = earlephilhower
board_build.filesystem_size = 0.5m
build_flags = -DUSE_TINYUSB
build_flags = -DUSE_TINYUSB -DBUILD_OFFLINE_ONLY
; Once https://github.com/platformio/platformio-core > 6.1.11 these can be removed
lib_ignore = WiFiNINA, WiFi101, Adafruit Zero DMA Library
lib_ignore = WiFiNINA, WiFi101, Adafruit Zero DMA Library, WiFiNINA_-_Adafruit_Fork
lib_compat_mode = soft ; can be strict once pio detects SleepyDog on RP2040


Expand Down Expand Up @@ -190,13 +197,32 @@ board_build.filesystem = littlefs
[env:featheresp32s2]
extends = common:esp32
board = featheresp32-s2
build_flags = -DARDUINO_ADAFRUIT_FEATHER_ESP32S2 -DBOARD_HAS_PSRAM -DBUILD_OFFLINE_ONLY
build_flags =
-DARDUINO_ADAFRUIT_FEATHER_ESP32S2
-DBOARD_HAS_PSRAM
-DBUILD_OFFLINE_ONLY
; -DSDFAT_FILE_TYPE=3
board_build.partitions = tinyuf2-partitions-4MB-noota.csv
;board_build.partitions = tinyuf2-partitions-4MB.csv
;build_type = debug
monitor_filters = esp32_exception_decoder
extra_scripts = pre:rename_usb_config.py

[env:featheresp32s2_debug]
extends = env:featheresp32s2
build_type = debug
build_flags =
-DARDUINO_ADAFRUIT_FEATHER_ESP32S2
-DBOARD_HAS_PSRAM
-DBUILD_OFFLINE_ONLY
; -DSDFAT_FILE_TYPE=3
-DDEBUG=1
-DCFG_TUSB_DEBUG=1
-DESP_LOG_LEVEL=ESP_LOG_VERBOSE
-DARDUINO_CORE_DEBUG_LEVEL=5
-DCORE_DEBUG_LEVEL=5
-DARDUHAL_LOG_LEVEL=5

; Adafruit Feather ESP32-S2 TFT
[env:adafruit_feather_esp32s2_tft]
extends = common:esp32
Expand Down Expand Up @@ -460,43 +486,62 @@ build_flags = -DUSE_TINYUSB=1
upload_port = /dev/cu.usbmodem1201

[env:raspberrypi_pico]
extends = common:rp2040
platform = https://github.com/maxgerhardt/platform-raspberrypi.git#develop
board = rpipico
platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git
board_build.filesystem_size = 0.5m
build_flags = -DUSE_TINYUSB
; Once https://github.com/platformio/platformio-core > 6.1.11 these can be removed
lib_ignore = WiFiNINA, WiFi101, Adafruit Zero DMA Library

[env:raspberrypi_pico_2]
extends = common:rp2040
platform = https://github.com/maxgerhardt/platform-raspberrypi.git#develop
board = rpipico2
platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git
board_build.filesystem_size = 0.5m
build_flags = -DUSE_TINYUSB -DBUILD_OFFLINE_ONLY
; Once https://github.com/platformio/platformio-core > 6.1.11 these can be removed
lib_ignore = WiFiNINA, WiFi101, Adafruit Zero DMA Library

[env:raspberrypi_pico_2w]
extends: common:rp2040
platform = https://github.com/maxgerhardt/platform-raspberrypi.git#develop
board = rpipico2w
platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git
board_build.filesystem_size = 0.5m
build_flags = -DUSE_TINYUSB -DBUILD_OFFLINE_ONLY
; Once https://github.com/platformio/platformio-core > 6.1.11 these can be removed

[env:adafruit_feather_adalogger]
extends = common:rp2040
platform = https://github.com/maxgerhardt/platform-raspberrypi.git#develop
board = adafruit_feather_adalogger
platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git
board_build.filesystem_size = 0.5m
build_flags = -DUSE_TINYUSB
; Once https://github.com/platformio/platformio-core > 6.1.11 these can be removed
lib_ignore = WiFiNINA, WiFi101, Adafruit Zero DMA Library

[env:adafruit_feather_rp2350_hstx]
extends = common:rp2040
platform = https://github.com/maxgerhardt/platform-raspberrypi.git#develop
board = adafruit_feather_rp2350_hstx
platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git
board_build.filesystem_size = 0.5m
build_flags = -DUSE_TINYUSB
; Once https://github.com/platformio/platformio-core > 6.1.11 these can be removed

[env:adafruit_metro_rp2350]
extends = common:rp2040
platform = https://github.com/brentru/platform-raspberrypi.git#develop
board = adafruit_metro_rp2350
platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git
board_build.filesystem_size = 0.5m
build_flags = -DUSE_TINYUSB -DBUILD_OFFLINE_ONLY
; Once https://github.com/platformio/platformio-core > 6.1.11 these can be removed
lib_ignore = WiFiNINA, WiFi101, Adafruit Zero DMA Library


[env:adafruit_metro_rp2350_debug]
extends = common:rp2040
platform = https://github.com/brentru/platform-raspberrypi.git#develop
platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git
board = adafruit_metro_rp2350
Expand Down Expand Up @@ -535,7 +580,6 @@ build_flags =
; build_flags = -DPIO_FRAMEWORK_ARDUINO_NO_USB
; -DPIO_FRAMEWORK_ARDUINO_ENABLE_IPV6
; Once https://github.com/platformio/platformio-core > 6.1.11 these can be removed
lib_ignore = WiFiNINA, WiFi101, Adafruit Zero DMA Library


[env:raspberypi_picow]
Expand Down Expand Up @@ -564,14 +608,14 @@ build_flags =
-DDEBUG_RP2040_CORE
-DDEBUG_RP2040_WIFI
-DLWIP_DEBUG
-DDEBUG_RP2040_PORT=Serial1
-DDEBUG_RP2040_UART_1
-DDEBUG_RP2040_UART=1
; -DDEBUG_RP2040_PORT=Serial1
; -DDEBUG_RP2040_UART_1
; -DDEBUG_RP2040_UART=1
-Og
; Enable debug stack protection
-fstack-protector
; Enable Exceptions
-DPIO_FRAMEWORK_ARDUINO_ENABLE_EXCEPTIONS
; -DPIO_FRAMEWORK_ARDUINO_ENABLE_EXCEPTIONS
; Enable RTTI
-DPIO_FRAMEWORK_ARDUINO_ENABLE_RTTI
; ; Enable default USB Stack of Pico SDK USB Stack with none of below usb options
Expand All @@ -580,3 +624,4 @@ build_flags =
; ; No USB stack
; build_flags = -DPIO_FRAMEWORK_ARDUINO_NO_USB
; -DPIO_FRAMEWORK_ARDUINO_ENABLE_IPV6
-DBUILD_OFFLINE_ONLY
7 changes: 7 additions & 0 deletions src/Wippersnapper_Boards.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,13 @@
#define STATUS_NEOPIXEL_NUM 1
#define SD_USE_SPI_1
#define SD_CS_PIN 23
#elif defined(ARDUINO_ADAFRUIT_FEATHER_RP2350_HSTX)
#define BOARD_ID "feather-rp2350-hstx"
#define USE_TINYUSB
#define USE_STATUS_NEOPIXEL
#define STATUS_NEOPIXEL_PIN PIN_NEOPIXEL
#define STATUS_NEOPIXEL_NUM 1
#define SD_CS_PIN 1
#elif defined(ARDUINO_ADAFRUIT_METRO_RP2350)
#define BOARD_ID "metro-rp2350"
#define USE_TINYUSB
Expand Down
8 changes: 8 additions & 0 deletions src/Wippersnapper_V2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,7 @@ void Wippersnapper_V2::haltErrorV2(const char *error,
if (!reboot) {
WsV2.feedWDTV2(); // Feed the WDT indefinitely to hold the WIPPER drive
// open
delay(1000);
} else {
// Let the WDT fail out and reset!
#ifndef ARDUINO_ARCH_ESP8266
Expand All @@ -946,6 +947,13 @@ void Wippersnapper_V2::haltErrorV2(const char *error,
delayMicroseconds(1000000);
#endif
}
WS_DEBUG_PRINT("ERROR ");
if (reboot) {
WS_DEBUG_PRINT("[RESET]: ");
} else {
WS_DEBUG_PRINT("[HANG]: ");
}
WS_DEBUG_PRINTLN(error);
}
}

Expand Down
6 changes: 5 additions & 1 deletion src/Wippersnapper_demo.ino
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ ws_adapter_offline wipper;

void setup() {
Serial.begin(115200);
while(!Serial);
// Wait for serial to connect when dev mode, but don't wait forever
uint8_t countdown = 200;
while(!Serial && countdown-- > 0) {
delay(10);
}
wipper.provision();
wipper.connect();
}
Expand Down
1 change: 1 addition & 0 deletions src/adapters/offline/ws_offline_pico.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#if defined(ARDUINO_RASPBERRY_PI_PICO) || \
defined(ARDUINO_RASPBERRY_PI_PICO_2) || \
defined(ARDUINO_ADAFRUIT_FEATHER_RP2040_ADALOGGER) || \
defined(ARDUINO_ADAFRUIT_FEATHER_RP2350_HSTX) || \
defined(ARDUINO_ADAFRUIT_METRO_RP2350)

#define PICO_CONNECT_TIMEOUT_MS 20000 /*!< Connection timeout (in ms) */
Expand Down
64 changes: 59 additions & 5 deletions src/components/i2c/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,56 @@ static const std::map<std::string, FnCreateI2CSensorDriver> I2cFactorySensor = {
const char *driver_name) -> drvBase * {
return new drvLc709203f(i2c, addr, mux_channel, driver_name);
}},
{"lis3dh",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvLis3dh(i2c, addr, mux_channel, driver_name);
}},
{"lis2mdl",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvLis2mdl(i2c, addr, mux_channel, driver_name);
}},
{"lis3mdl",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvLis3mdl(i2c, addr, mux_channel, driver_name);
}},
{"lsm303agr",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvLsm303agr(i2c, addr, mux_channel, driver_name);
}},
{"lsm303dlh",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvLsm303dlh(i2c, addr, mux_channel, driver_name);
}},
{"lsm6ds3",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvLsm6ds3(i2c, addr, mux_channel, driver_name);
}},
{"lsm6dso32",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvLsm6dso32(i2c, addr, mux_channel, driver_name);
}},
{"ism330dlc",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvIsm330dhcx(i2c, addr, mux_channel, driver_name);
}},
{"ism330dhcx",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvIsm330dhcx(i2c, addr, mux_channel, driver_name);
}},
{"lsm9ds1",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
return new drvLsm9ds1(i2c, addr, mux_channel, driver_name);
}},
{"lps3xhw",
[](TwoWire *i2c, uint16_t addr, uint32_t mux_channel,
const char *driver_name) -> drvBase * {
Expand Down Expand Up @@ -407,13 +457,13 @@ static const std::unordered_map<uint16_t, std::vector<const char *>>
{0x0B, {"lc709203f"}},
{0x12, {"pmsa003i"}},
{0x13, {"vncl4020"}},
{0x18, {"ds2484", "mcp9808", "mprls"}},
{0x19, {"mcp9808"}},
{0x18, {"ds2484", "mcp9808", "mprls", "lis3dh"}},
{0x19, {"mcp9808", "lsm303agr", "lsm303dlh", "lis3dh"}}, // LIS3DH last - seems to match LSM303AGR
{0x1A, {"mcp9808"}},
{0x1B, {"mcp9808"}},
{0x1C, {"mcp9808"}},
{0x1C, {"mcp9808", "lis3mdl"}},
{0x1D, {"mcp9808"}},
{0x1E, {"mcp9808"}},
{0x1E, {"mcp9808", "lis3mdl", "lis2mdl"}}, // "lsm303dlh", "lsm303agr", but rely on first addr
{0x1F, {"mcp9808"}},
{0x23, {"bh1750"}},
{0x28, {"pct2075"}},
Expand Down Expand Up @@ -458,7 +508,11 @@ static const std::unordered_map<uint16_t, std::vector<const char *>>
{0x62, {"scd40"}},
{0x68, {"mcp3421"}},
{0x69, {"sen55"}},
{0x6B, {"sen66"}},
{0x6A, {"lsm6dso32", "ism330dhcx", "lsm6ds3"}},
{0x6B, {"sen66", "lsm6ds3", "lsm6dso32", "ism330dhcx"}},
{0x6C, {"lsm303dlh"}},
{0x6D, {"lsm303agr"}},
{0x6E, {"lsm9ds1"}},
{0x70, {"pct2075", "shtc3"}},
{0x71, {"pct2075"}},
{0x72, {"pct2075"}},
Expand Down
9 changes: 9 additions & 0 deletions src/components/i2c/controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,19 @@
#include "drivers/drvIna237.h"
#include "drivers/drvIna238.h"
#include "drivers/drvIna260.h"
#include "drivers/drvIsm330dhcx.h"
#include "drivers/drvLc709203f.h"
#include "drivers/drvLis2mdl.h"
#include "drivers/drvLis3dh.h"
#include "drivers/drvLis3mdl.h"
#include "drivers/drvLps22hb.h"
#include "drivers/drvLps25hb.h"
#include "drivers/drvLps3xhw.h"
#include "drivers/drvLsm303agr.h"
#include "drivers/drvLsm303dlh.h"
#include "drivers/drvLsm6ds3.h"
#include "drivers/drvLsm6dso32.h"
#include "drivers/drvLsm9ds1.h"
#include "drivers/drvLtr329_Ltr303.h"
#include "drivers/drvLtr390.h"
#include "drivers/drvMCP9808.h"
Expand Down
13 changes: 13 additions & 0 deletions src/components/i2c/drivers/drvBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,15 @@ class drvBase {
return false;
}

/*!
@brief Gets a sensor's Boolean value.
@param booleanEvent
The Boolean value.
@returns True if the sensor value was obtained successfully, False
otherwise.
*/
virtual bool getEventBoolean(sensors_event_t *booleanEvent) { return false; }

/*!
@brief Gets a sensor's Raw value.
@param rawEvent
Expand Down Expand Up @@ -633,6 +642,10 @@ class drvBase {

// Maps SensorType to function calls
std::map<wippersnapper_sensor_SensorType, fnGetEvent> SensorEventHandlers = {
{wippersnapper_sensor_SensorType_SENSOR_TYPE_BOOLEAN,
[this](sensors_event_t *event) -> bool {
return this->getEventBoolean(event);
}},
{wippersnapper_sensor_SensorType_SENSOR_TYPE_UNSPECIFIED,
[this](sensors_event_t *event) -> bool {
return this->getEventRaw(event);
Expand Down
Loading
Loading