Repository navigation
feat(i2s): real hardware initialize() on modern peripheral (#3526 Phase 2b) - #3540
Conversation
…se 2b) `I2sPeripheralEsp32DevEsp::initialize()` no longer stubs — it now configures the I2S1 peripheral via the tested Yves C-style utilities (`i2s_define_bit_patterns` + `i2s_init` from `i2s_esp32dev.h`) that have been production since #3479. ## Hardware-ownership check Adds `i2s_is_initialized()` guard so the modern peripheral refuses to bind if the classic `ClocklessI2S<>` template on `-DFASTLED_ESP32_I2S=1` already claimed I2S1. First-in-wins prevents the two paths from racing on the shared hardware. ## Timing default Chipset timing defaults to canonical WS2812B (`TIMING_WS2812_800KHZ` via `to_runtime_timing<>`). Per-channel timing dispatch arrives with the modern engine's Phase 2b-encoder integration — for now this matches every previously-working I2S user's configuration. ## Scope - `initialize()` now real (was stub returning true without touching hardware). - `deinitialize()` still no-op — Phase 2b-deinit follow-up will free the ISR handle + DMA descriptors. - `transmit()` still returns synchronous stub — Phase 2b-DMA follow-up wires the wave8 encoder (#3528) output through I2S1 DMA. ## Verification - `bash test --cpp`: 345/345 pass (existing engine tests unchanged — no code path currently invokes `initialize()`). - `bash lint --cpp`: file clean (unrelated pre-existing violations in `platforms/arm/lpc/rx_sct_capture.cpp.hpp` fixed in follow-up). - **Bench**: `bash autoresearch esp32dev` flashes + boots clean on attached WROOM COM11 with new initialize() in the binary. `RESULT: {"type":"ready",...}` at ~2s uptime, ping successful. Since no code path invokes the modern peripheral in this build (`Bus::FLEX_IO, 0` still binds to `I2S_SPI` — Phase 2d does the swap), initialize() is dormant but present. Part of #3516 meta / #3526 Phase 2b. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Warning Review limit reached
Next review available in: 4 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 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 |
…3541) `I2sPeripheralEsp32DevEsp::deinitialize()` now calls `i2s_stop()` when `mBusy` is set at deinit time, so a mid-transmit teardown clears the peripheral's `tx_start` bit and stops DMA — no drift into the next caller's buffer. Note: this is not yet a FULL teardown. The ISR handle + DMA descriptor allocations from `i2s_init()` are still held onto so a re-init doesn't leak. That matches Yves's `gInitializedI2sInitialized` one-shot behavior. Full teardown lands with #3489 singleton migration since those resources are truly process-lifetime. ## Scope Small, safe, isolated change: - `deinitialize()` — real: calls `i2s_stop()` when busy. - Everything else unchanged. ## Verification - `bash test --cpp`: 345/345 pass. - `bash lint --cpp`: clean. - Bench: no invocation path currently exercises deinit + busy state (Bus::FLEX_IO,0 still binds to I2S_SPI; the modern peripheral isn't wired yet — Phase 2d), so this change is dormant on bench until Phase 2d lands. Confirmed by the previous PR (#3540) that the binary boots cleanly. Part of #3516 meta / #3526 Phase 2b. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
I2sPeripheralEsp32DevEsp::initialize() now configures I2S1 via the tested Yves utilities. Hardware-ownership check prevents racing with -DFASTLED_ESP32_I2S=1 users. Bench-verified: WROOM boots clean with new binary.
Test plan:
Part of #3526 Phase 2b. Deinit + real DMA transmit follow up.