Skip to content

feat(i2s): real hardware initialize() on modern peripheral (#3526 Phase 2b) - #3540

Merged
zackees merged 1 commit into
masterfrom
feat/i2s-phase2b-init-3526
Jul 1, 2026
Merged

zackees merged 1 commit into
masterfrom
feat/i2s-phase2b-init-3526

Conversation

@zackees

@zackees zackees commented Jul 1, 2026

Copy link
Copy Markdown
Member

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:

  • bash test --cpp: 345/345
  • bash autoresearch esp32dev: boot successful on attached WROOM

Part of #3526 Phase 2b. Deinit + real DMA transmit follow up.

…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]>
@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@zackees, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 4 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a9012c3e-fde4-4dde-bc33-a79f55f42311

📥 Commits

Reviewing files that changed from the base of the PR and between 39bf794 and 26cff9f.

📒 Files selected for processing (1)
  • src/platforms/esp/32/drivers/i2s/i2s_peripheral_esp32dev_esp.cpp.hpp
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/i2s-phase2b-init-3526

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
zackees merged commit 95965a4 into master Jul 1, 2026
9 of 10 checks passed
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Jul 1, 2026
zackees added a commit that referenced this pull request Jul 1, 2026
…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]>
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Jul 1, 2026
@zackees
zackees deleted the feat/i2s-phase2b-init-3526 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