Skip to content

feat(i2s): factory + Phase 2d slot-0 swap prep + agent-doc guardrail (#3526) - #3542

Merged
zackees merged 1 commit into
masterfrom
feat/i2s-phase2d-flexio-slot1-3526
Jul 1, 2026
Merged

zackees merged 1 commit into
masterfrom
feat/i2s-phase2d-flexio-slot1-3526

Conversation

@zackees

@zackees zackees commented Jul 1, 2026 •

Copy link
Copy Markdown
Member

New createI2sEsp32DevEngine() factory (unused until Phase 2c-SPI unblocks slot-0 swap). New REQUIRED agent-doc rule: 'One peripheral, one Bus::FLEX_IO slot' — captures the lesson that same peripheral means same slot, not parallel-bench-testing on separate slots. Test plan: 345/345 pass, lint clean.

Summary by CodeRabbit

  • New Features

    • Added support for selecting the classic ESP32 I2S engine when the platform and hardware capabilities allow it.
    • Introduced a safe fallback so unsupported builds skip the engine cleanly.
  • Documentation

    • Clarified C++ platform standards for registering hardware to a single bus slot.
    • Added guidance on avoiding conflicting peripheral bindings and documented the recommended unified-engine approach.

…3526)

## Changes

### `channel_engine_i2s_esp32dev.{h,cpp.hpp}` — new factory
Adds `fl::createI2sEsp32DevEngine()` that builds a
`ChannelEngineI2sEsp32Dev` wrapping a real
`I2sPeripheralEsp32DevEsp` peripheral, returned as
`shared_ptr<IChannelDriver>` for channel-manager registration. On
non-classic-ESP32 builds returns nullptr. Ready for Phase 2c-SPI /
Phase 2d proper to wire into `BusTraits<Bus::FLEX_IO, 0>` when the
SPI transmit path lands.

### `channel_drivers_esp32.impl.hpp` — comment explaining swap semantics
Documents in-code that the modern engine and the `I2S_SPI` driver
wrap the same I2S1 peripheral — both target `Bus::FLEX_IO, 0` and
the transition is a swap (Phase 2c-SPI first, then Phase 2d swaps
slot 0), not a coexistence. No binding change ships in this PR.

### `agents/docs/cpp-standards.md` — new REQUIRED rule
"One peripheral, one `Bus::FLEX_IO` slot (REQUIRED)" captures the
lesson from this session's Phase 2d prep attempt. Agent had proposed
registering the modern engine at slot 1 alongside `I2S_SPI` at slot
0 as a "bench-parallel" step — developer caught it: same peripheral
means same slot; slots are for genuinely separate silicon blocks
(e.g. ESP32-P4 PARLIO at slot 0, LCD_CAM at slot 1).

## Verification

- `bash test --cpp`: 345/345 pass.
- `bash lint --cpp`: clean.
- No runtime binding change — factory is library-linked but unused
  until Phase 2c-SPI unblocks the slot-0 swap.

Part of #3516 meta / #3526.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@zackees
zackees merged commit b6a989d into master Jul 1, 2026
11 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: 2c27ba42-a85d-4e98-92cf-0bdf85669318

📥 Commits

Reviewing files that changed from the base of the PR and between 16924f1 and d814b70.

📒 Files selected for processing (4)
  • agents/docs/cpp-standards.md
  • src/platforms/esp/32/channel_drivers_esp32.impl.hpp
  • src/platforms/esp/32/drivers/i2s/channel_engine_i2s_esp32dev.cpp.hpp
  • src/platforms/esp/32/drivers/i2s/channel_engine_i2s_esp32dev.h

📝 Walkthrough

Walkthrough

Adds a new factory function createI2sEsp32DevEngine() (declaration and implementation) that constructs a ChannelEngineI2sEsp32Dev with an I2sPeripheralEsp32DevEsp peripheral when ESP32Dev I2S support is enabled, returning nullptr otherwise. Also adds documentation on FLEX_IO slot binding rules and interim ESP32 driver swap rationale.

Changes

ESP32Dev I2S Engine Factory and Docs

Layer / File(s) Summary
Factory declaration and implementation for ESP32Dev I2S engine
src/platforms/esp/32/drivers/i2s/channel_engine_i2s_esp32dev.h, src/platforms/esp/32/drivers/i2s/channel_engine_i2s_esp32dev.cpp.hpp
Declares and implements createI2sEsp32DevEngine(), which conditionally constructs a ChannelEngineI2sEsp32Dev via fl::make_shared with an I2sPeripheralEsp32DevEsp peripheral, returning nullptr when FL_IS_ESP_32DEV/FASTLED_ESP32_HAS_I2S are not both enabled; adds conditional includes for ESP32 feature flags and the peripheral header.
FLEX_IO slot binding rules and interim swap documentation
agents/docs/cpp-standards.md, src/platforms/esp/32/channel_drivers_esp32.impl.hpp
Documents a rule requiring one physical peripheral per Bus::FLEX_IO slot with historical context from the I2S driver rewrite, and adds comments explaining a planned interim binding swap between the I2S_SPI slot and the modern parallel-out engine.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

Possibly related PRs

  • FastLED/FastLED#3473: The new createI2sEsp32DevEngine() factory targets the ESP32-Dev I2S channel engine/peripheral introduced in this PR.
  • FastLED/FastLED#3476: The factory and its feature gating depend on wiring the classic-ESP32 engine to the I2sPeripheralEsp32DevEsp implementation introduced there.
  • FastLED/FastLED#3430: Both reinforce the same parallel-IO unified engine/single binding path architectural rule via documentation.
✨ 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/i2s-phase2d-flexio-slot1-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.

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