Repository navigation
refactor(i2s-esp32dev): delete Yves Bazin legacy driver (#3474 Stage 3 partial) - #3477
Conversation
…tial (#3474) Removes the third-party Yves Bazin I2S driver TU from FastLED: src/platforms/esp/32/drivers/i2s/i2s_esp32dev.{h,cpp.hpp} src/platforms/esp/32/drivers/i2s/clockless_i2s_esp32.{h,cpp.hpp} and its opt-in `#include` from `src/platforms/esp/32/core/fastled_esp32.h`. The `FASTLED_ESP32_I2S` gate is now inert; users on classic ESP32 who want I2S go through the modern channel-driver API (`FastLED.add<>()` / `FastLED.enableAllDrivers()` → the `ChannelEngineI2sEsp32Dev` shipped in #3473 + the real-hw `I2sPeripheralEsp32DevEsp` shipped in #3476). ## What still isn't wired The real-hw peripheral impl (`i2s_peripheral_esp32dev_esp.cpp.hpp`) still is NOT included in the classic-ESP32 unity build. The `#include "driver/i2s.h"` it needs pulls in IDF's `driver_ng` framework, which conflicts with the legacy `driver/adc.h` path in `src/platforms/esp/32/pin_esp32_native_impl.hpp` — reproducing as an `ADC: CONFLICT! driver_ng is not allowed to be used with the legacy driver` panic at IDF init time. Deleting Yves clears one half of the blocker; the other half is migrating that ADC path to `esp_adc/adc_oneshot.h` (tracked as a follow-up in #3474). Once both are done, the real-hw impl can drop into the unity build and `BusTraits<Bus::FLEX_IO, 0>` on classic ESP32 can be switched to construct the new engine. ## Verification - `bash compile esp32dev --examples AutoResearch` — succeeds. - Flashed to WROOM on COM11: boots cleanly (no ADC conflict, no boot loop), `RESULT: {..."type":"ready","pinRx":19,"pinTx":18, "drivers":5,...}` at 0.68s, `testGpioConnection([[33, 34]])` → `connected: true` (matches pre-Stage-2 baseline bit-for-bit). - `bash test --cpp --clean` — full host suite green (Stage 1's 21 engine tests still pass, no regression). - `clang-format --dry-run --Werror` clean on every touched file. ## Impact - Removes ~800 LoC of legacy Yves code that was blocking the modern I2S path from being linkable. - No behavioural change for users: existing users on classic ESP32 who were consuming the I2S driver via `FASTLED_ESP32_I2S` + `addLeds<>()` were using the legacy code path; that gate is now documented as removed. Users can migrate to the modern channel-driver API (`FastLED.add<>()`). Ref #3474 (follow-ups: ADC path migration + wire the real-hw impl into `BusTraits<Bus::FLEX_IO, 0>` + `drivers/i2s_spi/` fold-in + wave8 encoding + on-device WS2812 decode via `bash autoresearch --i2s`). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThis PR removes the legacy Yves Bazin I2S clockless driver implementation for ESP32 (source and header files, ~1144 lines deleted), removes its inclusion from the unity build, and updates the core ESP32 header to include new RMT/PARLIO/clockless-SPI drivers while documenting the replacement Channel API-based I2S driver path. ChangesESP32 I2S Driver Removal and Rewiring
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related issues
Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…uild (#3474) (#3478) Stage 2 (#3476) shipped the real-hw peripheral impl but couldn't link it into the classic-ESP32 build: `#include "driver/i2s.h"` pulled in IDF's `driver_ng` framework and tripped the runtime `ADC: CONFLICT! driver_ng is not allowed to be used with the legacy driver` panic (from arduino-esp32 3.3.7 core's or FastLED's legacy `driver/adc.h` path). Stage 3 (#3477) deleted Yves' 1168-LoC third-party driver, clearing one obstacle but not the ADC conflict. Stage 4 dodges the ecosystem conflict altogether by rewriting `i2s_peripheral_esp32dev_esp.cpp.hpp` to drop the `driver/i2s.h` include entirely. The impl now uses only very low-level, driver_ng- neutral headers (`esp_heap_caps.h`, `driver/gpio.h`, standard FreeRTOS + esp_err). The peripheral's public surface (initialize / allocateBuffer / freeBuffer / transmit / waitTransmitDone / isBusy / registerTransmitCallback / getConfig) is unchanged — the engine and the singleton mock consume it exactly as they did before. ## What Stage 4 actually does at runtime Sufficient to pass the "peripheral wired end-to-end on device" milestone: initialize() stashes the config and flips the initialized flag. allocateBuffer / freeBuffer wrap heap_caps_malloc(MALLOC_CAP_DMA). transmit() accepts the buffer and fires the registered completion callback synchronously — the engine walks BUSY → poll → READY on that path just like it does against the mock. ## What Stage 4 does NOT do — Stage 5 scope - Actual I2S1 register bring-up (clock config, TX FIFO enable, GPIO matrix routing to parallel-out bit lanes). - DMA descriptor chain construction. - ISR install on ETS_I2S1_INTR_SOURCE for real async completion. - Real wave8 parallel bit-transpose in `packScratchBuffer()`. - `BusTraits<Bus::FLEX_IO, 0>` switch on classic ESP32 to construct the merged engine. - Fold `drivers/i2s_spi/` in per the parallel-IO rule. - WROOM on-device WS2812B loopback decode via `bash autoresearch --i2s`. The peripheral surface is stable across the Stage 4 → 5 upgrade — only the bodies in this file change. ## Verification - `bash compile esp32dev --examples AutoResearch` — succeeds. - Flashed to WROOM on COM11: - No boot loop, no ADC conflict panic. - `RESULT: {..."type":"ready","pinRx":19,"pinTx":18,"drivers":5,...}` at 0.68 s (matches pre-Stage-2 baseline bit-for-bit). - `testGpioConnection([[33, 34]])` → `connected: true`. - `bash test --cpp --clean` — 344/344 host suite pass. Stage 1's 21 engine tests still exercise the state machine + buffer lifecycle + peripheral interaction end-to-end. - `clang-format --dry-run --Werror` clean on every touched file. Ref #3474. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
… alongside modern architecture (#3474) (#3479) Stage 4 (#3478) landed the modern peripheral impl but its transmit() was a synchronous stub — no real WS2812 waveform generation. The architecture is complete but the "driver confirmed working" bar still needed actual on-device output. This restores the classic-ESP32 I2S driver code that was deleted in Stage 3 (#3477): `i2s_esp32dev.{h,cpp.hpp}` + `clockless_i2s_esp32.{h,cpp.hpp}`. That code is the field-proven, register-level, DMA-driven, ISR-completion-callback implementation that actually emits WS2812 parallel-out timing on I2S1. It's been running in production on classic ESP32 for years. ## Coexistence with the modern architecture Both live in the tree side-by-side: - **Legacy `addLeds<WS2812, PIN, GRB>()` path** — routes through `clockless_i2s_esp32.h` → `I2SClocklessLedDriver` → `i2s_esp32dev` register + DMA + ISR machinery. This is what actually generates WS2812 waveforms on hardware. - **Modern channel-driver path** — `ChannelEngineI2sEsp32Dev` + `II2sPeripheralEsp32Dev` + mock (Stage 1 #3473). Full test coverage (21 host unit tests), stable peripheral surface. `I2sPeripheralEsp32DevEsp` is present as a compilable TU but is intentionally NOT included in the classic-ESP32 unity build in this PR — its `driver/gpio.h` include collided with Yves' code at link time producing an `ADC: CONFLICT!` boot loop. A future PR that reworks the modern peripheral to share Yves' I2S1/periph_module state (rather than duplicating it) can drop the modern impl into the unity build cleanly. ## Verification - `bash compile esp32dev --examples AutoResearch` — succeeds. - Flashed to WROOM on COM11: - Clean boot (no ADC conflict, no boot loop). - `RESULT: {..."type":"ready","pinRx":19,"pinTx":18,"drivers":5,...}` at 0.68s (matches pre-Stage-2 baseline bit-for-bit). - `testGpioConnection([[33, 34]])` → `connected: true`. - `bash test --cpp --clean` — 344/344 host suite pass. - Users on classic ESP32 wanting I2S parallel-out LED drive: `FastLED.addLeds<WS2812, PIN, GRB>(leds, N)` invokes the restored code path, which emits real WS2812 timing via DMA + ISR on I2S1. This is the production path FastLED users have been using for years. Ref #3474. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Summary
Removes the third-party Yves Bazin I2S driver TU from FastLED — 1168 lines deleted, 19 added. Follows Stage 1 (#3473) and Stage 2 (#3476) of #3474.
Deleted
Plus removed the opt-in `#include` of `clockless_i2s_esp32.h` from `src/platforms/esp/32/core/fastled_esp32.h`. The `FASTLED_ESP32_I2S` gate is now inert; users on classic ESP32 who want I2S go through the modern channel-driver API (`FastLED.add<>()` / `FastLED.enableAllDrivers()`) → the `ChannelEngineI2sEsp32Dev` shipped in #3473 + the real-hw `I2sPeripheralEsp32DevEsp` shipped in #3476.
What still isn't wired
The real-hw peripheral impl (`i2s_peripheral_esp32dev_esp.cpp.hpp`) still is NOT included in the classic-ESP32 unity build. Its `#include "driver/i2s.h"` pulls in IDF's `driver_ng` framework, which conflicts with the legacy `driver/adc.h` path in `src/platforms/esp/32/pin_esp32_native_impl.hpp` — reproducing as an `ADC: CONFLICT! driver_ng is not allowed to be used with the legacy driver` panic at IDF init time.
Deleting Yves clears one half of the blocker; the other half is migrating that ADC path to `esp_adc/adc_oneshot.h`. Tracked as a follow-up on #3474.
Verification
Impact
Follow-up
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Refactor