Repository navigation
Closed
Labels
area: coreLED drivers, color math, animationsplatform: esp32ESP32, S2, S3, C3, C6, H2type: featureNew capability or enhancement
Description
Part of #3715.
Problem
ESP32 hardware SPI has two backends selected in src/platforms/esp/32/core/fastspi_esp32.h:34:
#if defined(ARDUINO) && !defined(FL_NO_ARDUINO)
#include "platforms/esp/32/core/fastspi_esp32_arduino.h" // Arduino SPIClass
#else
#include "platforms/esp/32/core/fastspi_esp32_idf.h" // IDF spi_master
#endiffastspi_esp32_arduino.h depends on the Arduino core: #include <SPI.h> (line 13), SPIClass mLedSPI member (line 123), beginTransaction(SPISettings(..., MSBFIRST, SPI_MODE0)) (line 177), plus an internal VSPI/HSPI vs SPI2/SPI3 fork for Arduino framework 3.1.0.
A complete IDF-native backend already exists (fastspi_esp32_idf.h, driver/spi_master.h) — but it is only exercised when ARDUINO is undefined, i.e. essentially never in CI today.
Fix
- Make
fastspi_esp32_idf.hthe default backend on all ESP32 builds (Arduino included). The IDF SPI driver is present in every Arduino-ESP32 install, so this removes the fork rather than adding one. - Retire
fastspi_esp32_arduino.h. If a release of caution is wanted, keep it one cycle behind an opt-in escape hatch (FASTLED_ESP32_SPI_ARDUINO=1), then delete. - Remove the
<SPI.h>LDF hint atsrc/platforms/esp/32/ldf_headers.h:20once the Arduino backend is gone (the hint exists solely so PlatformIO's dependency finder pre-installs the Arduino SPI library).
Risks / compat notes
- Bus-sharing: users who pass an
SPIClassthey also use for other devices. Audit whether any public API accepts/exposesSPIClasson ESP32; the IDF backend must keep DMA + transaction semantics compatible (FASTLED_ESP32_SPI_BULK_TRANSFERpaths at the top offastspi_esp32.h). driver/spi_master.hAPI is stable across IDF 4.x/5.x/6.x; IDF 3.x classic-ESP32 SPI needs verification on theesp32dev_idf33leg (the olderspi_masterAPI predates some flags — fork withesp_version.hpredicates if needed).- APA102/SK9822/LPD8806 users on ESP32 are the affected population — hardware-verify one clocked chipset via
bash autoresearchbefore merging.
Acceptance criteria
-
fastspi_esp32.hno longer forks ondefined(ARDUINO). - No
<SPI.h>/SPIClassreferences remain undersrc/platforms/esp/32/. - All IDF CI legs green; a clocked-chipset example (e.g.
Apa102) compiles on each. - Hardware smoke on one ESP32 board with an APA102 strip (or SPI loopback capture on the bench).
Metadata
Metadata
Assignees
Labels
area: coreLED drivers, color math, animationsplatform: esp32ESP32, S2, S3, C3, C6, H2type: featureNew capability or enhancement
Type
Projects
- StatusShow more project fieldsDone
Activity
fix(docs): FASTLED_ESP32_SPI_ARDUINO -> FL_ESP32_SPI_ARDUINO
feat(esp32): make ESP-IDF spi_master the only ESP32 SPI backend (#3727)