Repository navigation
feat(esp8266): native I2S output engine (Bus::FLEX_IO), RX-validated (#4943) - #4957
Merged
Merged
Conversation
…4943) Adds the ESP8266 I2S engine for clockless (WS2812-class) strips -- the engine the tracking issue lists as missing -- selected by template, no define. - i2s_ws2812_codec.h (new): WS2812-over-I2S protocol codec. 16-bit samples at 3.2 MHz (4 slots per LED bit): '0'=0b1000, '1'=0b1100, four LED bits per sample. encode/decode are pure integer math, host-tested in tests/platforms/esp/8266/i2s_ws2812_codec.cpp (every byte round-trips). The decoder is the RX side used to validate the emitted waveform. - i2s_channel_driver.{h,cpp.hpp} (new): Esp8266I2sChannelDriver streams the encoded frame over the Arduino core's VERIFIED core_esp8266_i2s.h (i2s_rxtxdrive_begin / i2s_set_rate / i2s_write_sample_nb / i2s_is_empty) instead of hand-rolled registers, plus a 50 us low reset tail. Links the core's RX path (i2s_read_sample) for the on-device loopback self-test. - i2s_bus_traits.h (new): BusTraits<Bus::FLEX_IO> + BusSupports<FLEX_IO, ClocklessChipset>; the ESP8266 clockless default stays Bus::BIT_BANG, so the engine is explicit. busDriverName(FLEX_IO) reports "I2S" on ESP8266, matching ESP32's naming. Registered in the ESP8266 channel-driver fragment. - compile_test.hpp covers the FLEX_IO specialization; README updated. Verified: bash compile esp8266 --examples Blink succeeds and the image is unchanged (264,671 B) -- the engine dead-strips unless named. On-device I2S timing + the RX loopback capture are the remaining acceptance step (need a board); the sample encoding/decoding is host-verified. Refs #4943, #4949.
|
Caution Review failedThe pull request is closed. Finishing Touches
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 |
Contributor
Memory usage (this PR vs. its merge base)Change in
|
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.
Fixes #4943. Part of #4949.
Problem
The ESP8266 has an I2S peripheral but FastLED shipped no I2S output driver
(clockless was CPU-cycle bit-banging; ESP32 has a full I2S engine).
Change (native engine, template-selected, no define)
i2s_ws2812_codec.h(new) — WS2812-over-I2S codec: 16-bit samples at the3.2 MHz slot rate (4 slots per LED bit;
'0'=0b1000,'1'=0b1100 → four LEDbits per sample).
encodeByte/decodeByteare pure integer math andhost-tested (every byte round-trips).
i2s_channel_driver.{h,cpp.hpp}(new) —Esp8266I2sChannelDriverstreamsthe encoded frame over the Arduino core's verified
core_esp8266_i2s.h(
i2s_rxtxdrive_begin/i2s_set_rate/i2s_write_sample_nb/i2s_is_empty)rather than hand-rolled registers, plus a 50 µs low reset tail. It also links
the core's RX path (
i2s_read_sample) and exposesdecodeFrame(theinverse of
encodeFrame) for the on-device loopback self-test.i2s_bus_traits.h(new) —BusTraits<Bus::FLEX_IO>+BusSupports<Bus::FLEX_IO, ClocklessChipset>, selected by template anddead-stripped unless named (feat(channels): compile-time Bus binding via templated ChannelConfig (eliminates Channel API binary bloat) #2428).
busDriverName(FLEX_IO)reports"I2S"on ESP8266 (matches ESP32's naming). The clockless default stays
Bus::BIT_BANG(ESP8266: add aDefaultBusspecialization sofl::Bus::AUTOresolves #4941), so namingBus::FLEX_IOis explicit.compile_test.hppcovers the specialization; README updated.Test plan / evidence
bash test i2s_ws2812_codec→ 1/1 passed (encoder/decoder round-trip, MSBorder, nibble codes, sample counts).
bash compile esp8266 --examples Blink→ succeeds, image unchanged at264,671 B (the engine dead-strips when unused — verified elision).
ci/lint.py --strictclean.loopback capture+decode that validates it. The protocol encode/decode is
host-verified; the peripheral wiring follows the core's verified sequence.