Skip to content

esp32: retire fastspi_esp32_arduino.h — make IDF spi_master the only ESP32 SPI backend #3718

Closed

Description

@zackees

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
#endif

fastspi_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

  1. Make fastspi_esp32_idf.h the 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.
  2. 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.
  3. Remove the <SPI.h> LDF hint at src/platforms/esp/32/ldf_headers.h:20 once 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 SPIClass they also use for other devices. Audit whether any public API accepts/exposes SPIClass on ESP32; the IDF backend must keep DMA + transaction semantics compatible (FASTLED_ESP32_SPI_BULK_TRANSFER paths at the top of fastspi_esp32.h).
  • driver/spi_master.h API is stable across IDF 4.x/5.x/6.x; IDF 3.x classic-ESP32 SPI needs verification on the esp32dev_idf33 leg (the older spi_master API predates some flags — fork with esp_version.h predicates if needed).
  • APA102/SK9822/LPD8806 users on ESP32 are the affected population — hardware-verify one clocked chipset via bash autoresearch before merging.

Acceptance criteria

  • fastspi_esp32.h no longer forks on defined(ARDUINO).
  • No <SPI.h>/SPIClass references remain under src/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).

Activity

  1. added
    type: feature
    platform: esp32
    area: core
    on Jul 22, 2026
  2. added a commit that references this issue on Jul 22, 2026
    17a7d03
  3. moved this from Triage to Done in FastLED Trackeron Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: coreplatform: esp32type: feature

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions