Skip to content

Audit and retire legacy SPI output paths where the Channel API is the default (follow-up to #4919) #4928

Closed as not planned

Description

@zackees

Problem

#4919 sped up ESP32SPIOutput, the legacy per-platform SPI output, by ~34×. But on ESP32, addLeds<APA102/SK9822/WS2801/...> no longer reaches that class by default. Since at least 3.10.6, FASTLED_SPI_USES_CHANNEL_API=1 (src/FastLED.h:118) routes SPI chipsets through fl::SlimSpiBridgeController and the Channel drivers instead. We spent review and hardware time on code that most users no longer run, while it still carries bugs (#4918 had been open since #1609 in March 2024).

Measured on an ESP32-C6, 256 APA102 LEDs at 6 MHz (#4919 comment):

The legacy path is not dead yet; it is reachable in two ways

  1. Opt-out flag: -DFASTLED_SPI_USES_CHANNEL_API=0 on ESP32, Teensy 4.x and RP2040/RP2350.
  2. Direct controllers: sketches that construct a chipset controller themselves (APA102Controller<>, LPD8806Controller<>, WS2801Controller<>, P9813Controller<>, SM16716Controller<>, HD108Controller<>, ...). Each still declares typedef fl::SPIOutput<...> SPI (src/fl/chipsets/*.h). On ESP32 that resolves to SPIDeviceProxy → ESP32SPIOutput.

On platforms where the Channel API is off (STM32, AVR, SAMD, nRF52, ESP8266, ...), the legacy SPIOutput is the production path. It is not retired there.

Audit (step 1)

For every platform, list:

  • Is FASTLED_SPI_USES_CHANNEL_API default on or off? Is FASTLED_HAS_CHANNELS on or off?
  • Which legacy SPI classes exist: ESP32SPIOutput (fastspi_esp32_idf.h, fastspi_esp32_arduino.h, src/platforms/arduino/spi/fastspi_esp32_arduino.h), SPIDeviceProxy, spi_output_template.h, Teensy 4 / RP hardware SPI outputs, and others. Which of these are reachable only through (1) or (2) above?
  • Every in-repo user of those classes: examples (including examples/AutoResearch/AutoResearchSpiDma.h, which uses ARMHardwareSPIOutputDMA<>), tests, CI board configs, and docs.
  • Legacy-only knobs that do nothing on the default path, for example FASTLED_ESP32_SPI_BULK_TRANSFER and the new FL_ESP32_SPI_DMA_* / FL_ESP32_SPI_NUM_BUFFERS from fix(esp32): real DMA burst for clocked-SPI chipsets (APA102 etc.) #4919.
  • Do the open issues and PRs target legacy or channel code? Tag them.

Fix (step 2), per platform where the Channel API is the default

  • Route direct chipset controllers (path 2) through the Channel/SlimSpiBridge backend, so that SPIOutput is no longer the ESP32/Teensy4/RP backend for them.
  • Decide what happens to the opt-out flag (path 1). Either deprecate it with a compile-time warning for one release and then remove the legacy classes, or keep it and document it as an unmaintained fallback. Recommended: deprecate, then remove.
  • Delete the dead legacy classes and knobs, or mark them unmaintained. Make sure fix(esp32): real DMA burst for clocked-SPI chipsets (APA102 etc.) #4919's improvements are not needed on any remaining path.
  • For platforms where legacy is still the default, keep them. Track a separate decision on whether to bring each onto the Channel API.
  • Add a lint or test guard so new fixes don't land on an unreachable backend. For example, a check that fails if ESP32 code includes fastspi_esp32_idf.h while FASTLED_SPI_USES_CHANNEL_API=1, outside the opt-out path.
  • Repeat the same audit for clockless: legacy RMT/I2S controllers vs. the channel drivers.

Acceptance

  • A table in this issue: platform → default SPI backend → legacy classes → status (removed / deprecated / still default).
  • On ESP32, Teensy 4.x and RP, no src/ code path reaches a legacy SPIOutput unless the user explicitly opts out.
  • Hardware evidence via bash autoresearch for each converted platform.

Activity

  1. added
    area: ci
    area: drivers
    platform: esp32
    and removed
    area: ci
    on Oct 26, 2026
  2. zackees commented on Oct 26, 2026

    @zackees
    MemberAuthor

    oh no, we're gonna need one sub issue per platform in the generated issue for this after research has been done

  3. added
    sanitized
    on Nov 6, 2026
  4. zackees commented on Nov 22, 2026

    @zackees
    MemberAuthor

    SPI output audit (origin/master 0df09737ac)

    Method: read FastLED.h routing (FASTLED_SPI_USES_CHANNEL_API at FastLED.h:118-124), the SPIOutput dispatch in platforms/spi_output_template.h, and each platform's template and BusSupports<…, SpiChipsetConfig>. No builds. Routes I followed end to end: ESP32, STM32, RP opt-out, and LPC. Every chipset controller still declares typedef fl::SPIOutput<…> SPI (fl/chipsets/apa102.h:43, hd108.h:42, lpd880x.h:30,110, p9813.h:27, sm16716.h:26, ws2801.h:26). On the legacy path, addLeds<APA102> resolves through ClockedChipsetHelper (FastLED.h:1157) to APA102Controller, then to SPIOutput.

    Platform Default addLeds<APA102> Legacy class(es) compiled Legacy still production? Channel covers SPI chipsets? Retire?
    AVR legacy AVRHardwareSPIOutput avr/fastspi_avr.h:431/629/823, USART :33/:231; otherwise GenericSoftwareSPIOutput yes no no, sole path
    ESP32 (all variants) Channel: SlimSpiBridgeController (FastLED.h:121) SPIDeviceProxy esp/32/drivers/spi/spi_device_proxy.h:43 → ESP32SPIOutput esp/32/core/fastspi_esp32_idf.h:137 (or arduino/spi/fastspi_esp32_arduino.h:114 when FL_ESP32_SPI_ARDUINO) only with =0 opt-out or direct APA102Controller<> yes (SPI host, I2S/LCD/PARLIO FLEX_IO) yes, once direct controllers are routed to Channel
    ESP8266 legacy ESP8266HSPIOutput esp/8266/fastspi_esp8266_hspi.h:44 (pins 13/14), otherwise software yes opt-in only: Bus::SPI HSPI driver via FastLED.add<SpiChipsetConfig> no
    STM32 legacy (deliberate, stm32/fastspi_arm_stm32.h:36-52) STM32SPIOutput :73, SPIDeviceProxy stm32/spi_device_proxy.h:43 yes partial: multi-lane SpiHw2/4/8 on stream-DMA families only no
    nRF51 / nRF52 legacy NRF51SPIOutput nrf51/fastspi_arm_nrf51.h:29; NRF52HardwareSPIOutput nrf52/fastspi_arm_nrf52.h:40, SPIDeviceProxy nrf52/spi_device_proxy.h:58 yes nRF52: adapter registered, explicit use only; nRF51: no no
    SAMD21/51 (+SAM Due) legacy (#4593 revert) SAMDHardwareSPIOutput sam/fastspi_arm_sam.h:231 (MOSI/SCK) or software; Due SAMHardwareSPIOutput :35 yes adapter registered, explicit use only (d51/README.md:10) no
    Teensy 3.x / LC legacy ARMHardwareSPIOutput teensy31_32/fastspi_arm_k20.h:108, teensy36/fastspi_arm_k66.h:115, teensy_lc/fastspi_arm_kl26.h:95 yes (3.5/3.6 resolution unverified) no no. Exception: arm/k66/fastspi_arm_k66.h:115 is an orphan copy with no includer, so it is dead code
    Teensy 4.x Channel SPIDeviceProxy mxrt1062/spi_device_proxy.h:53 → Teensy4HardwareSPIOutput teensy4_common/fastspi_arm_mxrt1062.h:25; software if the pins aren't hardware SPI pins only with opt-out or direct controllers yes (LPSPI adapter, FlexIO/ObjectFLED) yes, same precondition as ESP32 (unverified on hardware)
    RP2040/2350 Channel: ChannelEngineRpSpi no RP hardware class; falls through to GenericSoftwareSPIOutput (rpcommon/README.md:174) only with opt-out or direct controllers (software SPI) yes (PL022, PIO) partial: nothing RP-specific to delete; the shared software class stays
    Renesas (+Giga, SAME53) legacy, shared software GenericSoftwareSPIOutput shared/spi_bitbang/generic_software_spi.h:45; ArdunioCoreSPIOutput platforms/fastspi_arduino_core.h:19 is included but no SPIOutput uses it yes (software) no no
    Apollo3 legacy APOLLO3HardwareSPIOutput apollo3/fastspi_apollo3.h:57, only with FASTLED_ALL_PINS_HARDWARE_SPI; software otherwise yes no no
    LPC8xx legacy, shared software ARMHardwareSPIOutput lpc/spi_arm_lpc.h:103, ARMHardwareSPIOutputDMA lpc/spi_arm_lpc_dma.h:147 are not in the SPIOutput dispatch software is production; the LPC hardware classes are reachable only directly (AutoResearchSpiDma.h:90) no no (wire them up instead; #2845)
    MGM240 legacy, shared software GenericSoftwareSPIOutput yes (unverified) no no
    WASM / stub WASM fake SPI → clockless; stub StubSPIOutput stub/fastspi_stub_generic.h:24 host test double test only n/a no

    Also: fastspi_ref.h:21 (REFHardwareSPIOutput) has no in-repo reference. fastspi_nop.h:20 is cited only by PORTING.md:52.

  5. zackees commented on Nov 22, 2026

    @zackees
    MemberAuthor

    The audit is done; the table is in the comment above. Removing the legacy classes is descoped. They are still the production SPI path on AVR, STM32, nRF51/52, SAMD, ESP8266, Teensy 3.x/LC and Apollo3, and the direct chipset controllers (APA102Controller<> and the rest) are public API that resolve through fl::SPIOutput on every platform. Retirement candidates: ESP32 and Teensy 4.x, once direct controllers route through the Channel API, plus the orphaned src/platforms/arm/k66/fastspi_arm_k66.h copy. RP has no RP-specific legacy class to remove. Per-platform retirement can be filed from the table when someone takes it on, with device or real-SDK evidence.

  6. moved this from Triage to Done in FastLED Trackeron Nov 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: driversplatform: esp32sanitized

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions