From 7c649a5bf0caf74dbcb7e2aae86c5bbd06966d7f Mon Sep 17 00:00:00 2001 From: vincentfenet Date: Wed, 28 Feb 2024 15:00:57 +0100 Subject: [PATCH 1/2] add ESP32_EXT_FLASH and FLASH_NO_WREN build flags --- src/Adafruit_SPIFlashBase.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Adafruit_SPIFlashBase.cpp b/src/Adafruit_SPIFlashBase.cpp index fa6833b..05b7d4f 100644 --- a/src/Adafruit_SPIFlashBase.cpp +++ b/src/Adafruit_SPIFlashBase.cpp @@ -61,7 +61,7 @@ Adafruit_SPIFlashBase::Adafruit_SPIFlashBase( _ind_active = true; } -#if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_RP2040) +#if !defined(ESP32_EXT_FLASH) && (defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_RP2040)) // For ESP32 and RP2040 the SPI flash is already detected and configured // We could skip the initial sequence @@ -323,7 +323,11 @@ void Adafruit_SPIFlashBase::waitUntilReady(void) { } // both WIP and WREN bit should be clear +#if !defined(FLASH_NO_WREN) while (readStatus() & 0x03) { +#else + while (readStatus() & 0x01) { +#endif yield(); } } From 7136f1c6964c4e424dd8e4eb8c97bfb0a11fd34a Mon Sep 17 00:00:00 2001 From: vincentfenet Date: Wed, 28 Feb 2024 15:08:34 +0100 Subject: [PATCH 2/2] code format for clang-format --- src/Adafruit_SPIFlashBase.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Adafruit_SPIFlashBase.cpp b/src/Adafruit_SPIFlashBase.cpp index 05b7d4f..b89528c 100644 --- a/src/Adafruit_SPIFlashBase.cpp +++ b/src/Adafruit_SPIFlashBase.cpp @@ -61,7 +61,8 @@ Adafruit_SPIFlashBase::Adafruit_SPIFlashBase( _ind_active = true; } -#if !defined(ESP32_EXT_FLASH) && (defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_RP2040)) +#if !defined(ESP32_EXT_FLASH) && \ + (defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_RP2040)) // For ESP32 and RP2040 the SPI flash is already detected and configured // We could skip the initial sequence