Repository navigation
Closed as not planned
Closed as not planned
Copy link
Labels
area: driversChipset drivers (WS2812, APA102, etc)platform: esp32ESP32, S2, S3, C3, C6, H2sanitizedTitle, body and conversation screened; review text requires separate screening.
Description
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):
- Channel path (default): 2.5 ms per frame on
master, unchanged by fix(esp32): real DMA burst for clocked-SPI chipsets (APA102 etc.) #4919. - Legacy path (
-DFASTLED_SPI_USES_CHANNEL_API=0): 19 ms onmaster, 0.56 ms after fix(esp32): real DMA burst for clocked-SPI chipsets (APA102 etc.) #4919.
The legacy path is not dead yet; it is reachable in two ways
- Opt-out flag:
-DFASTLED_SPI_USES_CHANNEL_API=0on ESP32, Teensy 4.x and RP2040/RP2350. - Direct controllers: sketches that construct a chipset controller themselves (
APA102Controller<>,LPD8806Controller<>,WS2801Controller<>,P9813Controller<>,SM16716Controller<>,HD108Controller<>, ...). Each still declarestypedef fl::SPIOutput<...> SPI(src/fl/chipsets/*.h). On ESP32 that resolves toSPIDeviceProxy→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_APIdefault on or off? IsFASTLED_HAS_CHANNELSon 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 usesARMHardwareSPIOutputDMA<>), tests, CI board configs, and docs. - Legacy-only knobs that do nothing on the default path, for example
FASTLED_ESP32_SPI_BULK_TRANSFERand the newFL_ESP32_SPI_DMA_*/FL_ESP32_SPI_NUM_BUFFERSfrom 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
SPIOutputis 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.hwhileFASTLED_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 legacySPIOutputunless the user explicitly opts out. - Hardware evidence via
bash autoresearchfor each converted platform.
Metadata
Metadata
Assignees
Labels
area: driversChipset drivers (WS2812, APA102, etc)platform: esp32ESP32, S2, S3, C3, C6, H2sanitizedTitle, body and conversation screened; review text requires separate screening.
Type
Projects
- StatusShow more project fieldsDone
Activity
zackees commentedon Oct 26, 2026
oh no, we're gonna need one sub issue per platform in the generated issue for this after research has been done
zackees commentedon Nov 22, 2026
SPI output audit (origin/master
0df09737ac)Method: read
FastLED.hrouting (FASTLED_SPI_USES_CHANNEL_APIatFastLED.h:118-124), theSPIOutputdispatch inplatforms/spi_output_template.h, and each platform's template andBusSupports<…, SpiChipsetConfig>. No builds. Routes I followed end to end: ESP32, STM32, RP opt-out, and LPC. Every chipset controller still declarestypedef 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 throughClockedChipsetHelper(FastLED.h:1157) toAPA102Controller, then toSPIOutput.addLeds<APA102>AVRHardwareSPIOutputavr/fastspi_avr.h:431/629/823, USART:33/:231; otherwiseGenericSoftwareSPIOutputSlimSpiBridgeController(FastLED.h:121)SPIDeviceProxyesp/32/drivers/spi/spi_device_proxy.h:43→ESP32SPIOutputesp/32/core/fastspi_esp32_idf.h:137(orarduino/spi/fastspi_esp32_arduino.h:114whenFL_ESP32_SPI_ARDUINO)=0opt-out or directAPA102Controller<>FLEX_IO)ESP8266HSPIOutputesp/8266/fastspi_esp8266_hspi.h:44(pins 13/14), otherwise softwareBus::SPIHSPI driver viaFastLED.add<SpiChipsetConfig>stm32/fastspi_arm_stm32.h:36-52)STM32SPIOutput:73,SPIDeviceProxystm32/spi_device_proxy.h:43NRF51SPIOutputnrf51/fastspi_arm_nrf51.h:29;NRF52HardwareSPIOutputnrf52/fastspi_arm_nrf52.h:40,SPIDeviceProxynrf52/spi_device_proxy.h:58SAMDHardwareSPIOutputsam/fastspi_arm_sam.h:231(MOSI/SCK) or software; DueSAMHardwareSPIOutput:35d51/README.md:10)ARMHardwareSPIOutputteensy31_32/fastspi_arm_k20.h:108,teensy36/fastspi_arm_k66.h:115,teensy_lc/fastspi_arm_kl26.h:95arm/k66/fastspi_arm_k66.h:115is an orphan copy with no includer, so it is dead codeSPIDeviceProxymxrt1062/spi_device_proxy.h:53→Teensy4HardwareSPIOutputteensy4_common/fastspi_arm_mxrt1062.h:25; software if the pins aren't hardware SPI pinsChannelEngineRpSpiGenericSoftwareSPIOutput(rpcommon/README.md:174)GenericSoftwareSPIOutputshared/spi_bitbang/generic_software_spi.h:45;ArdunioCoreSPIOutputplatforms/fastspi_arduino_core.h:19is included but noSPIOutputuses itAPOLLO3HardwareSPIOutputapollo3/fastspi_apollo3.h:57, only withFASTLED_ALL_PINS_HARDWARE_SPI; software otherwiseARMHardwareSPIOutputlpc/spi_arm_lpc.h:103,ARMHardwareSPIOutputDMAlpc/spi_arm_lpc_dma.h:147are not in theSPIOutputdispatchAutoResearchSpiDma.h:90)GenericSoftwareSPIOutputStubSPIOutputstub/fastspi_stub_generic.h:24Also:
fastspi_ref.h:21(REFHardwareSPIOutput) has no in-repo reference.fastspi_nop.h:20is cited only byPORTING.md:52.zackees commentedon Nov 22, 2026
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 throughfl::SPIOutputon every platform. Retirement candidates: ESP32 and Teensy 4.x, once direct controllers route through the Channel API, plus the orphanedsrc/platforms/arm/k66/fastspi_arm_k66.hcopy. 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.