Skip to content

Commit

Permalink
Add Adafruit RP2040 Adalogger to PIO and codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
brentru committed Feb 26, 2025
1 parent affdf95 commit 13b1496
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 24 deletions.
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ tests/__pycache__/
# These sometimes contain credentials, don't commit them!
src/Wippersnapper_demo_wokwi.ino
data/
examples/Wippersnapper_demo_offline/.theia/
examples/Wippersnapper_demo_offline/.vscode/
examples/Wippersnapper_demo_offline/build/

# Test results
report.xml
report.xml

# VSCode settings
.vscode/settings.json
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
"span": "cpp",
"*.tcc": "cpp",
"list": "cpp",
"unordered_set": "cpp"
"unordered_set": "cpp",
"format": "cpp",
"text_encoding": "cpp",
"regex": "cpp"
},
"C_Cpp.dimInactiveRegions": false,
"dotnet.defaultSolution": "disable",
Expand Down
15 changes: 12 additions & 3 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,15 @@ build_flags = -DUSE_TINYUSB=1
-DADAFRUIT_METRO_M4_AIRLIFT_LITE
upload_port = /dev/cu.usbmodem1201

[env:raspberrypi_pico]
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]
platform = https://github.com/maxgerhardt/platform-raspberrypi.git#develop
board = rpipico2
Expand All @@ -419,12 +428,12 @@ 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]
[env:adafruit_feather_adalogger]
platform = https://github.com/maxgerhardt/platform-raspberrypi.git#develop
board = rpipico
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
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

Expand Down
6 changes: 6 additions & 0 deletions src/Wippersnapper_Boards.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,12 @@
#define USE_TINYUSB
#define USE_STATUS_LED
#define STATUS_LED_PIN LED_BUILTIN
#elif defined(ARDUINO_ADAFRUIT_FEATHER_RP2040_ADALOGGER)
#define BOARD_ID "feather-rp2040-adalogger"
#define USE_TINYUSB
#define USE_STATUS_NEOPIXEL
#define STATUS_NEOPIXEL_PIN PIN_NEOPIXEL
#define STATUS_NEOPIXEL_NUM 1
#else
#warning "Board type not identified within Wippersnapper_Boards.h!"
#endif
Expand Down
4 changes: 2 additions & 2 deletions src/Wippersnapper_demo.ino
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
// All text above must be included in any redistribution.

#include "ws_adapters.h"
ws_adapter_wifi wipper;
//ws_adapter_wifi wipper;
// Uncomment the following line to use the offline adapter for Pico
// ws_adapter_offline wipper;
ws_adapter_offline wipper;

#define WS_DEBUG // Enable debug output!

Expand Down
8 changes: 5 additions & 3 deletions src/adapters/offline/ws_offline_pico.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
#ifndef WS_OFFLINE_PICO
#define WS_OFFLINE_PICO

#if defined(ARDUINO_RASPBERRY_PI_PICO) || defined(ARDUINO_RASPBERRY_PI_PICO_2)
#if defined(ARDUINO_RASPBERRY_PI_PICO) || \
defined(ARDUINO_RASPBERRY_PI_PICO_2) || \
defined(ARDUINO_ADAFRUIT_FEATHER_RP2040_ADALOGGER)

#define PICO_CONNECT_TIMEOUT_MS 20000 /*!< Connection timeout (in ms) */
#define PICO_CONNECT_RETRY_DELAY_MS 200 /*!< delay time between retries. */
Expand Down Expand Up @@ -170,5 +172,5 @@ class ws_offline_pico : public Wippersnapper_V2 {
}
};

#endif // RASPBERRY_PI_PICO_W
#endif // WS_NONET_PICO_H
#endif // RASPBERRY_PI_PICO
#endif // WS_OFFLINE_PICO
27 changes: 14 additions & 13 deletions src/provisioning/tinyusb/Wippersnapper_FS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@
defined(ARDUINO_RASPBERRY_PI_PICO_W) || \
defined(ARDUINO_ADAFRUIT_FEATHER_ESP32S3_REVTFT) || \
defined(ARDUINO_ADAFRUIT_FEATHER_ESP32S2_REVTFT) || \
defined(ARDUINO_ADAFRUIT_QTPY_ESP32S3_N4R2) || \
defined(ARDUINO_RASPBERRY_PI_PICO) || \
defined(ARDUINO_RASPBERRY_PI_PICO_2)
defined(ARDUINO_ADAFRUIT_QTPY_ESP32S3_N4R2) || \
defined(ARDUINO_RASPBERRY_PI_PICO) || \
defined(ARDUINO_RASPBERRY_PI_PICO_2) || \
defined(ARDUINO_ADAFRUIT_FEATHER_RP2040_ADALOGGER)
#include "Wippersnapper_FS.h"
// On-board external flash (QSPI or SPI) macros should already
// defined in your board variant if supported
Expand Down Expand Up @@ -174,7 +175,7 @@ Wippersnapper_FS::~Wippersnapper_FS() {
config.json file.
*/
/**************************************************************************/
void Wippersnapper_FS::GetSDCSPin() {
void Wippersnapper_FS::GetSDCSPin() {
File32 file_cfg;
DeserializationError error;
// Attempt to open and deserialize the config.json file
Expand Down Expand Up @@ -554,16 +555,16 @@ void Wippersnapper_FS::fsHalt(String msg) {
*/
/**************************************************************************/
void Wippersnapper_FS::fsHalt(String msg, ws_led_status_t ledStatusColor) {
TinyUSBDevice.attach();
delay(500);
statusLEDSolid(ledStatusColor);
while (1) {
WS_DEBUG_PRINT("Execution Halted: ");
WS_DEBUG_PRINTLN(msg.c_str());
delay(5000);
yield();
}
TinyUSBDevice.attach();
delay(500);
statusLEDSolid(ledStatusColor);
while (1) {
WS_DEBUG_PRINT("Execution Halted: ");
WS_DEBUG_PRINTLN(msg.c_str());
delay(5000);
yield();
}
}

#ifdef ARDUINO_FUNHOUSE_ESP32S2
/**************************************************************************/
Expand Down
4 changes: 3 additions & 1 deletion src/ws_adapters.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ typedef ws_wifi_ninafw ws_adapter_wifi;
/**
* The following are adapters for use without networking functionality.
*/
#elif defined(ARDUINO_RASPBERRY_PI_PICO_2) || defined(ARDUINO_RASPBERRY_PI_PICO)
#elif defined(ARDUINO_RASPBERRY_PI_PICO_2) || \
defined(ARDUINO_RASPBERRY_PI_PICO) || \
defined(ARDUINO_ADAFRUIT_FEATHER_RP2040_ADALOGGER)
#include "adapters/offline/ws_offline_pico.h"
typedef ws_offline_pico ws_adapter_offline;
#else
Expand Down

0 comments on commit 13b1496

Please sign in to comment.