Repository navigation
feat(i2s): unified engine SPI path via delegate (#3526 Phase 2c) - #3544
Conversation
`ChannelEngineI2sEsp32Dev::show()` now handles SPI batches — forwards to the tested `ChannelDriverI2sSpi` via `createI2sSpiEngine()` factory (lazy-initialised on first SPI batch so pure-clockless builds don't link the delegate). Same I2S1 peripheral, same one-slot binding — the modern engine is the entry point, the delegate owns the transmit lifecycle. ## Behavior matrix (updated) | Batch composition | Result | |---------------------------|-------------------------------------------| | All clockless (existing) | Wave8 encoding → peripheral transmit ✅ | | All SPI | Delegate to ChannelDriverI2sSpi ✅ | | Mixed clockless + SPI | ERROR (peripheral is single-mode) | ## poll() surfaces delegate state Delegate's `poll()` return is surfaced up: - READY → drop to READY, release channels - DRAINING → engine reports DRAINING (per Channel Engine DMA Wait Pattern in `agents/docs/cpp-standards.md`) - ERROR → drop to ERROR, release channels - BUSY → stay in current state ## Verification - `bash test --cpp`: 345/345 pass (2 existing Phase 2c tests updated to allow BUSY or ERROR from SPI path — invariant is that the clockless peripheral is untouched by SPI batches). - `bash lint --cpp`: clean. - Bench: flashed to attached WROOM COM11, boot clean, ping successful. `flexIoDeviceInfo` reports `I2S_SPI` at `Bus::FLEX_IO, 0` (unchanged — the modern engine only receives channels via `setExclusiveDriver<>()` for the specific engine name; slot 0 stays with the existing driver until Phase 2d swaps it). Part of #3516 meta / #3526 Phase 2c. 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 (3)
📝 WalkthroughWalkthroughChannelEngineI2sEsp32Dev now delegates homogeneous SPI-only channel batches to a lazily-created ChannelDriverI2sSpi instance (mSpiDelegate) instead of rejecting SPI mode as an unimplemented stub. show() forwards SPI channels to the delegate and sets BUSY, or falls back to ERROR if unavailable. poll() maps delegate states (READY/DRAINING/ERROR) to engine states. Tests updated accordingly. ChangesI2S-SPI Delegate Integration
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related issues
Possibly related PRs
✨ 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 |
…3526) (#3545) Replaces the if/else chain in `ChannelEngineI2sEsp32Dev::poll()`'s SPI-delegate handling with an explicit `switch` over `DriverState::Value`. Compiler now enforces coverage — if a new DriverState enum value gets added, the missing case is a warning / error at build time rather than a silent unhandled state. Same behavior as the if/else version: READY / DRAINING / ERROR surface up to callers with the appropriate cleanup; BUSY stays in the current state. Follow-up to #3544. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
ChannelEngineI2sEsp32Dev::show() now handles SPI batches by delegating to the tested ChannelDriverI2sSpi. Mixed batches still rejected (peripheral is single-mode). poll() surfaces delegate's DRAINING/READY/ERROR states correctly. Bench: flashed clean on WROOM.
Summary by CodeRabbit
New Features
Bug Fixes
Tests