Repository navigation
feat(esp8266): expose hardware HSPI as Bus::SPI; retire FASTLED_ALL_PINS_HARDWARE_SPI (#4942) - #4951
Merged
Merged
Conversation
…INS_HARDWARE_SPI The register-level HSPI driver (SPI1 on GPIO13/14) was reachable only through the legacy SPIOutput<> dispatch, and a non-HSPI pair needed the define-gated Arduino-SPI shim (FASTLED_ALL_PINS_HARDWARE_SPI). Add a channel-API driver for the hardware pair and drop the define. - Esp8266HspiChannelDriver streams the already-encoded SPI byte stream (start frame + pixels + end frame) over the SPI1 FIFO, blocking per transfer. canHandle() accepts only the fixed GPIO13 (data) / GPIO14 (clock) pad pair; every other pair falls through to the shared bit-bang bus. - bus_traits.h specializes BusTraits<Bus::SPI> + BusSupports<Bus::SPI, SpiChipsetConfig> so the driver is selected by template and dead-stripped unless named (#2428). Registered in the ESP8266 channel-driver fragment. - Retire FASTLED_ALL_PINS_HARDWARE_SPI: delete the Arduino-SPI shim (fastspi_esp8266.h), drop its include from fastled_esp8266.h and the spi_output_template.h branch, and remove the ESP8266 clause from fastspi.h's FL_DATA_RATE_MHZ interpretation. The software bit-bang covers all non-HSPI pairs. Verified: bash compile esp8266 --examples Blink succeeds and the firmware image is byte-for-byte unchanged (unused driver eliminated). Refs #4942, #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 |
Member
Author
Memory check (
|
| master | this stack | Δ | |
|---|---|---|---|
| image_flash | 264,671 B | 264,667 B | -4 B |
| attributed flash | 203,252 B | 203,249 B | -3 B |
| RAM | 6,808 B | 6,808 B | 0 B |
No memory regression: the unused ESP8266 engines are dead-stripped (template selection + linker elimination), so naming none of them costs ~nothing, as intended (#2428).
This was referenced Oct 31, 2026
TKDFusion
pushed a commit
to TKDFusion/Software-FastLED-FASTLED
that referenced
this pull request
Nov 8, 2026
…rule (FastLED#4940) Umbrella for the ESP8266 define-elimination epic (FastLED#4949): state the rule and guard it. - agents/docs/cpp-standards.md: new REQUIRED section 'Driver selection is by template, never a code-enabling define' with the BusTraits/BusSupports shape and the retired offenders (FASTLED_ESP8266_UART, FASTLED_ALL_PINS_HARDWARE_SPI, FL_ESP8266_EMBEDDED_FS). - ci/lint_cpp/driver_enable_define_checker.py (new): a Python FileContentChecker that flags a preprocessor guard wrapping a 'platforms/...' include under src/platforms/** in an FL_*/FASTLED_* macro -- the code-enabling-define shape. The guards shipping today are grandfathered in driver_enable_define_amnesty.txt (regenerate with --generate-amnesty); new ones fail. Registered in run_all_checkers.py. - ci/tests/test_driver_enable_define_checker.py (new): flagged/allowed cases plus a tree-wide check that the amnesty still covers src/platforms. Wired into PY_SMOKE (guard in test_native_ci_modes.py bumped 9 -> 10). The three conversions land in FastLED#4951 / FastLED#4952 / FastLED#4953; this PR is the rule + guard. Refs FastLED#4940, FastLED#4949.
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.
Stacked on #4950 (#4941). Fixes #4942. Part of #4949.
Problem
The register-level HSPI driver (
fastspi_esp8266_hspi.h, SPI1 on GPIO13/14) wasreachable only through the legacy
SPIOutput<>dispatch, and a non-HSPI pin pairneeded the define-gated Arduino-SPI shim (
FASTLED_ALL_PINS_HARDWARE_SPI→fastspi_esp8266.h). No ESP8266BusTraits<Bus::SPI>, so the channel API couldnot select the hardware engine.
Change (template selection, not a code-enabling define)
hspi_channel_driver.{h,cpp.hpp}(new) —Esp8266HspiChannelDriverstreams the already-encoded SPI byte stream (start frame + pixels + end frame)
over the SPI1 FIFO, blocking per ≤64-byte transfer.
canHandle()accepts onlythe fixed GPIO13 (data) / GPIO14 (clock) pad pair; every other pair falls
through to the shared bit-bang bus. Extraction of the register sequence mirrors
the proven
ESP8266HSPIOutput(GPC/GPEC/GPF,SPI1U/SPI1U1/SPI1CLK,SPI1W0..15/SPI1CMD); clock division reuses host-testedesp8266::hspiClockFor().hspi_bus_traits.h(new) — specializesBusTraits<Bus::SPI>+BusSupports<Bus::SPI, SpiChipsetConfig>, so namingBus::SPIkeeps the TU andeverything else dead-strips (feat(channels): compile-time Bus binding via templated ChannelConfig (eliminates Channel API binary bloat) #2428). Registered in the ESP8266 channel-driver
fragment.
FASTLED_ALL_PINS_HARDWARE_SPI— deletefastspi_esp8266.h, dropits include from
fastled_esp8266.hand thespi_output_template.hbranch, andremove the ESP8266 clause from
fastspi.h'sFL_DATA_RATE_MHZinterpretation.compile_test.hpp— assert theBus::SPIspecialization is present andresolves through
TypedChannel<Bus::SPI, SpiChipsetConfig>.Test plan / evidence
bash compile esp8266 --examples Blinksucceeds; the firmware image isbyte-for-byte identical to the pre-change build (flash 264667 B, RAM 27536 B)
— the unused driver is link-eliminated, which is the point.
compile_test.hppasserts run on every ESP8266 build.add<SpiChipsetConfig>()) is theremaining acceptance step (needs a board).