Repository navigation
feat(i2s): engine mode-dispatch scaffolding for SPI batches (#3526 Phase 2c prep) - #3534
Merged
Merged
Conversation
…ase 2c prep) Adds per-channel mode dispatch in `ChannelEngineI2sEsp32Dev::show()` so mixed clockless+SPI batches and pure-SPI batches are refused cleanly with `DriverState::ERROR` instead of silently sending garbage through the clockless wave8 encoder. Sets up the Phase 2c architecture: the peripheral is the dispatch boundary (per the parallel-IO unified-engine rule in `agents/docs/cpp-standards.md`), and I2S1 can only run one mode at a time. The engine now recognizes each channel's mode and routes accordingly. ## Behavior matrix | Batch composition | Result | |---------------------------|-------------------------------------------| | All clockless (existing) | Wave8 encoding → peripheral transmit ✅ | | All SPI | ERROR state (Phase 2c-SPI stub) | | Mixed clockless + SPI | ERROR state (mixed batches never allowed) | The SPI-path stub is deliberate: the actual SPI transmit machinery (FIFO width reconfigure, DMA slot, clock rate) is bench-blocked because it needs WROOM validation. Once the Phase 2c-SPI PR lands with real transmit code, only the two ERROR-returning early-outs change to full `showSpi()` calls. Clockless behavior is preserved bit-identical — all 4 existing engine tests still pass unchanged. ## Test additions 3 new `FL_TEST_CASE`s in `channel_engine_i2s_esp32dev.cpp`: - Pure clockless batch still succeeds (regression protection) - Pure SPI batch rejected with ERROR + no peripheral transmit - Mixed batch rejected with ERROR + no peripheral transmit + both channels released from in-use marking New test helper `makeSpiChannelData(dataPin, clockPin, byte_count, fill_byte)` produces a channel with `SpiChipsetConfig` so the mode dispatch has real SPI channels to reject. ## What this does NOT do - Does NOT implement `showSpi()` — that's the real Phase 2c PR (bench-blocked). - Does NOT change the current clockless code path — pure clockless batches take the exact same wave8 encoding + peripheral transmit they did before. ## Verification - `bash test --cpp`: 345/345 pass (3 new subcases inside existing test file) - `bash lint --cpp`: clean Part of #3516 meta / #3526 Phase 2c prep. 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 (2)
📝 WalkthroughWalkthroughAdds a dispatch check in ChannelEngineI2sEsp32Dev::show() that inspects the in-flight channel batch for clockless and SPI channels, rejecting mixed or SPI-only batches with an error state, and adds tests verifying clockless-only success versus SPI/mixed rejection. ChangesDispatch gate and tests
Estimated code review effort: 2 (Simple) | ~15 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 |
5 tasks
This was referenced Jul 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds per-channel mode dispatch in
ChannelEngineI2sEsp32Dev::show()so mixed clockless+SPI batches and pure-SPI batches are refused cleanly withDriverState::ERRORinstead of silently sending garbage.Sets up Phase 2c architecture: peripheral is the dispatch boundary (parallel-IO unified-engine rule), and I2S1 can only run one mode at a time.
Once the real SPI transmit machinery lands (Phase 2c-SPI PR, bench-blocked), the two ERROR early-outs become full
showSpi()calls with no other engine changes needed.Behavior matrix
Test plan
bash test --cpp: 345/345 pass (3 new subcases inside existing test)bash lint --cpp: cleanPart of #3516 meta / #3526 Phase 2c prep.
Summary by CodeRabbit
Bug Fixes
Tests