Skip to content

Commit 2c210ee

Browse files
committed
update msc external flash example to work with rp2040
1 parent 4f2c0ab commit 2c210ee

File tree

7 files changed

+47
-15
lines changed

7 files changed

+47
-15
lines changed

examples/Composite/mouse_external_flash/.feather_rp2040_tinyusb.test.skip

Whitespace-only changes.

examples/Composite/mouse_external_flash/mouse_external_flash.ino

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,29 @@
2323
// MSC External Flash Config
2424
//--------------------------------------------------------------------+
2525

26-
// Uncomment to run example with FRAM
27-
// #define FRAM_CS A5
28-
// #define FRAM_SPI SPI
26+
// Un-comment to run example with custom SPI SPI and SS e.g with FRAM breakout
27+
// #define CUSTOM_CS A5
28+
// #define CUSTOM_SPI SPI
2929

30-
#if defined(FRAM_CS) && defined(FRAM_SPI)
31-
Adafruit_FlashTransport_SPI flashTransport(FRAM_CS, FRAM_SPI);
30+
#if defined(CUSTOM_CS) && defined(CUSTOM_SPI)
31+
Adafruit_FlashTransport_SPI flashTransport(CUSTOM_CS, CUSTOM_SPI);
3232

3333
#elif defined(ARDUINO_ARCH_ESP32)
3434
// ESP32 use same flash device that store code.
3535
// Therefore there is no need to specify the SPI and SS
3636
Adafruit_FlashTransport_ESP32 flashTransport;
3737

38+
#elif defined(ARDUINO_ARCH_RP2040)
39+
// RP2040 use same flash device that store code.
40+
// Therefore there is no need to specify the SPI and SS
41+
// Use default (no-args) constructor to be compatible with CircuitPython partition scheme
42+
Adafruit_FlashTransport_RP2040 flashTransport;
43+
44+
// For generic usage:
45+
// Adafruit_FlashTransport_RP2040 flashTransport(start_address, size)
46+
// If start_address and size are both 0, value that match filesystem setting in
47+
// 'Tools->Flash Size' menu selection will be used
48+
3849
#else
3950
// On-board external flash (QSPI or SPI) macros should already
4051
// defined in your board variant if supported

examples/MassStorage/msc_external_flash/.feather_rp2040_tinyusb.test.skip

Whitespace-only changes.

examples/MassStorage/msc_external_flash/msc_external_flash.ino

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,29 @@
2727
#include "Adafruit_SPIFlash.h"
2828
#include "Adafruit_TinyUSB.h"
2929

30-
// Uncomment to run example with FRAM
31-
// #define FRAM_CS A5
32-
// #define FRAM_SPI SPI
30+
// Un-comment to run example with custom SPI SPI and SS e.g with FRAM breakout
31+
// #define CUSTOM_CS A5
32+
// #define CUSTOM_SPI SPI
3333

34-
#if defined(FRAM_CS) && defined(FRAM_SPI)
35-
Adafruit_FlashTransport_SPI flashTransport(FRAM_CS, FRAM_SPI);
34+
#if defined(CUSTOM_CS) && defined(CUSTOM_SPI)
35+
Adafruit_FlashTransport_SPI flashTransport(CUSTOM_CS, CUSTOM_SPI);
3636

3737
#elif defined(ARDUINO_ARCH_ESP32)
3838
// ESP32 use same flash device that store code.
3939
// Therefore there is no need to specify the SPI and SS
4040
Adafruit_FlashTransport_ESP32 flashTransport;
4141

42+
#elif defined(ARDUINO_ARCH_RP2040)
43+
// RP2040 use same flash device that store code.
44+
// Therefore there is no need to specify the SPI and SS
45+
// Use default (no-args) constructor to be compatible with CircuitPython partition scheme
46+
Adafruit_FlashTransport_RP2040 flashTransport;
47+
48+
// For generic usage:
49+
// Adafruit_FlashTransport_RP2040 flashTransport(start_address, size)
50+
// If start_address and size are both 0, value that match filesystem setting in
51+
// 'Tools->Flash Size' menu selection will be used
52+
4253
#else
4354
// On-board external flash (QSPI or SPI) macros should already
4455
// defined in your board variant if supported

examples/MassStorage/msc_external_flash_sdcard/.feather_rp2040_tinyusb.test.skip

Whitespace-only changes.

examples/MassStorage/msc_external_flash_sdcard/msc_external_flash_sdcard.ino

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,28 @@
2424
#include "Adafruit_SPIFlash.h"
2525
#include "Adafruit_TinyUSB.h"
2626

27-
// Uncomment to run example with FRAM
28-
// #define FRAM_CS A5
29-
// #define FRAM_SPI SPI
27+
// Un-comment to run example with custom SPI SPI and SS e.g with FRAM breakout
28+
// #define CUSTOM_CS A5
29+
// #define CUSTOM_SPI SPI
3030

31-
#if defined(FRAM_CS) && defined(FRAM_SPI)
32-
Adafruit_FlashTransport_SPI flashTransport(FRAM_CS, FRAM_SPI);
31+
#if defined(CUSTOM_CS) && defined(CUSTOM_SPI)
32+
Adafruit_FlashTransport_SPI flashTransport(CUSTOM_CS, CUSTOM_SPI);
3333

3434
#elif defined(ARDUINO_ARCH_ESP32)
3535
// ESP32 use same flash device that store code.
3636
// Therefore there is no need to specify the SPI and SS
3737
Adafruit_FlashTransport_ESP32 flashTransport;
3838

39+
#elif defined(ARDUINO_ARCH_RP2040)
40+
// RP2040 use same flash device that store code.
41+
// Therefore there is no need to specify the SPI and SS
42+
// Use default (no-args) constructor to be compatible with CircuitPython partition scheme
43+
Adafruit_FlashTransport_RP2040 flashTransport;
44+
45+
// For generic usage: Adafruit_FlashTransport_RP2040(start_address, size)
46+
// If start_address and size are both 0, value that match filesystem setting in
47+
// 'Tools->Flash Size' menu selection will be used
48+
3949
#else
4050
// On-board external flash (QSPI or SPI) macros should already
4151
// defined in your board variant if supported

examples/MassStorage/msc_sdfat/.feather_rp2040_tinyusb.test.skip

Whitespace-only changes.

0 commit comments

Comments
 (0)