Skip to content

Commit

Permalink
Allow for SPI1 port to be used on Feather RP2040 Adalogger
Browse files Browse the repository at this point in the history
  • Loading branch information
brentru committed Feb 26, 2025
1 parent 835b601 commit 8d261ec
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/Wippersnapper_Boards.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@
#define USE_STATUS_NEOPIXEL
#define STATUS_NEOPIXEL_PIN PIN_NEOPIXEL
#define STATUS_NEOPIXEL_NUM 1
#define SD_USE_SPI_1
#else
#warning "Board type not identified within Wippersnapper_Boards.h!"
#endif
Expand Down
10 changes: 4 additions & 6 deletions src/Wippersnapper_demo.ino
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,15 @@
#include "ws_adapters.h"
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!

void setup() {
Serial.begin(115200);
while (!Serial) delay(10);
while (!Serial)
delay(10);
wipper.provision();
wipper.connect();
}

void loop() {
wipper.run();
}
void loop() { wipper.run(); }
5 changes: 5 additions & 0 deletions src/provisioning/sdcard/ws_sdcard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@
*/
/**************************************************************************/
ws_sdcard::ws_sdcard()
#ifdef SD_USE_SPI_1
: _sd_spi_cfg(WsV2.pin_sd_cs, DEDICATED_SPI, SPI_SD_CLOCK, &SPI1) {
#else
: _sd_spi_cfg(WsV2.pin_sd_cs, DEDICATED_SPI, SPI_SD_CLOCK) {
#endif
is_mode_offline = false;
_use_test_data = false;
_is_soft_rtc = false;
Expand All @@ -38,6 +42,7 @@ ws_sdcard::ws_sdcard()
is_mode_offline = false;
return;
}

// Card initialized - calculate file limits
is_mode_offline = true;
calculateFileLimits();
Expand Down
3 changes: 3 additions & 0 deletions src/provisioning/sdcard/ws_sdcard.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
defined(ARDUINO_ADAFRUIT_FEATHER_ESP32_V2)
#define SPI_SD_CLOCK \
SD_SCK_MHZ(25) ///< For ESP32/Pico silicon rev 3.0, we clock at 25MHz
#elif defined(ARDUINO_ADAFRUIT_FEATHER_RP2040_ADALOGGER)
#define SPI_SD_CLOCK \
SD_SCK_MHZ(16) ///< For the RP2040 adalogger, we clock at 16MHz
#else
#define SPI_SD_CLOCK SD_SCK_MHZ(50) ///< Default SPI clock speed
#endif
Expand Down

0 comments on commit 8d261ec

Please sign in to comment.