Skip to content

refactor(i2s-esp32dev): delete Yves Bazin legacy driver (#3474 Stage 3 partial) - #3477

Merged
zackees merged 1 commit into
masterfrom
feat/3474-i2s-stage3
Jul 1, 2026
Merged

zackees merged 1 commit into
masterfrom
feat/3474-i2s-stage3

Conversation

@zackees

@zackees zackees commented Jul 1, 2026 •

Copy link
Copy Markdown
Member

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

  • `src/platforms/esp/32/drivers/i2s/i2s_esp32dev.h`
  • `src/platforms/esp/32/drivers/i2s/i2s_esp32dev.cpp.hpp`
  • `src/platforms/esp/32/drivers/i2s/clockless_i2s_esp32.h`
  • `src/platforms/esp/32/drivers/i2s/clockless_i2s_esp32.cpp.hpp`

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

  • `bash compile esp32dev --examples AutoResearch` — succeeds.
  • Flashed to WROOM on COM11: boots cleanly (no ADC conflict, no boot loop), `RESULT: {"chip":"ESP32 (Xtensa)","type":"ready","pinRx":19,"pinTx":18,"drivers":5,...}` at 0.68s.
  • `testGpioConnection([[33, 34]])` → `connected: true` (matches pre-Stage baseline bit-for-bit).
  • `bash test --cpp --clean` — full host suite green.
  • `clang-format --dry-run --Werror` clean on every touched file.

Impact

  • -1168 / +19 LoC. Removes 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 migrate to the modern channel-driver API.
  • Boot behaviour is bit-for-bit identical to Stage 2.

Follow-up

  • ADC path migration (`pin_esp32_native_impl.hpp`).
  • Wire the real-hw impl into `BusTraits<Bus::FLEX_IO, 0>`.
  • Fold `drivers/i2s_spi/` into the merged engine per the parallel-IO code-review rule.
  • Real wave8 bit-transpose encoding in `packScratchBuffer()`.
  • On-device WS2812B decode via `bash autoresearch --i2s`.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • ESP32 support now automatically enables the available clockless driver options when present.
    • Classic ESP32 users are guided to the newer driver API for I2S-based output.
  • Refactor

    • Removed legacy ESP32 I2S support paths and related fallback behavior.
    • Updated build selection to rely on the newer driver implementations and clearer platform guidance.

…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]>
@zackees
zackees merged commit c38172c into master Jul 1, 2026
6 of 9 checks passed
@coderabbitai

coderabbitai Bot commented Jul 1, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8e047e38-05dc-4cea-a815-d775ea75cb17

📥 Commits

Reviewing files that changed from the base of the PR and between 6087fef and 05dbbbd.

📒 Files selected for processing (6)
  • src/platforms/esp/32/core/fastled_esp32.h
  • src/platforms/esp/32/drivers/i2s/_build.cpp.hpp
  • src/platforms/esp/32/drivers/i2s/clockless_i2s_esp32.cpp.hpp
  • src/platforms/esp/32/drivers/i2s/clockless_i2s_esp32.h
  • src/platforms/esp/32/drivers/i2s/i2s_esp32dev.cpp.hpp
  • src/platforms/esp/32/drivers/i2s/i2s_esp32dev.h

📝 Walkthrough

Walkthrough

This 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.

Changes

ESP32 I2S Driver Removal and Rewiring

Layer / File(s) Summary
Core header include updates
src/platforms/esp/32/core/fastled_esp32.h
Adds conditional includes for RMT, PARLIO, and IDF5 clockless SPI drivers gated by FASTLED_ESP32_HAS_* macros; removes legacy FASTLED_ESP32_I2S include path, replacing it with comments pointing to the new drivers/i2s/ Channel API via enableDriver/enableAllDrivers.
Unity build exclusion
src/platforms/esp/32/drivers/i2s/_build.cpp.hpp
Removes inclusion of legacy clockless_i2s_esp32.cpp.hpp and i2s_esp32dev.cpp.hpp, keeps LCD_CAM and mock peripheral includes, and updates comments explaining the driver_ng vs legacy ADC conflict.
Legacy driver deletion
src/platforms/esp/32/drivers/i2s/clockless_i2s_esp32.cpp.hpp, clockless_i2s_esp32.h, i2s_esp32dev.cpp.hpp, i2s_esp32dev.h
Deletes the entire legacy I2S clockless driver implementation and header, including fl::ClocklessI2S, DMA buffer management, bit-pattern generation, GPIO setup, and related functions/structs.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related issues

Possibly related PRs

  • FastLED/FastLED#2480: Reroutes ESP32 clockless/I2S inclusion to the Channel API and driver-enabling path, overlapping with this PR's driver set changes.
  • FastLED/FastLED#2515: Modifies the same fastled_esp32.h file to add conditional inclusion of the PARLIO clockless driver.

Poem

A rabbit hops through code once dense,
Sweeping out drivers no longer immense.
Old I2S bows, its work now done,
New channels rise beneath the sun. 🐰✨
Hop on, FastLED, lighter and free!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/3474-i2s-stage3

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

zackees added a commit that referenced this pull request Jul 1, 2026
…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]>
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Jul 1, 2026
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Jul 1, 2026
zackees added a commit that referenced this pull request Jul 1, 2026
… 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]>
@zackees
zackees deleted the feat/3474-i2s-stage3 branch August 21, 2026 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant