You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(mgm240): honor FASTLED_FORCE_SOFTWARE_PINS via the core pin API (#5072) - #5151
Part of #5072 (does not close it; see "Not met"). Part of #5024.
On MGM240, FASTLED_FORCE_SOFTWARE_PINS had no effect. _FL_DEFPIN in fastpin_arm_mgm240.h explicitly specialized fl::FastPin<PIN>, which overrides the forced software primary template in fastpin_base.h.
Fix
Native pin type:_FL_DEFPIN now always emits fl::Mgm240HwPin<PIN>, the native P_SET/P_CLR _ARMPIN. It adds the FastPin<PIN> specialization only when software pins are not forced.
Timing-critical drivers: the clockless driver and the ezWS2812 39 MHz and 78 MHz bit-bang drivers use Mgm240HwPin<DATA_PIN>. A software pin cannot meet their cycle-counted timing.
Forced mode uses the core pin API: the Silicon Labs Arduino core has no portOutputRegister; a probe build confirmed it. The portOutputRegister/digitalPinToPort fallbacks in led_sysdefs_arm_mgm240.h are placeholders, not EFR32MG24 GPIO addresses, so the register-based software pin would write to unrelated memory. Forced mode therefore also defines FASTLED_NO_PINMAP, which makes FastPin the NoPinMapPin.
Forced-mode signals: forced mode emits the usual warning and sets NO_HARDWARE_PIN_SUPPORT.
Unmapped pins: these fail with a single descriptive static assertion.
Evidence
Real Silabs SDK (bash compile mgm240):
A temporary Blink probe statically asserts:
which type FastPin<2|3|4|5|13> derives from;
in forced modes, that it derives from NoPinMapPin;
that Mgm240HwPin<N> is native in every mode.
The probe calls setOutput/hi/lo/toggle, APA102 on 4/5 (generic software SPI), MY9221 on 2/3, and the default clockless path.
Force off, force on, and force on with FASTLED_NO_PINMAP all build with their expected selection.
With the original header, force on fails with every pin still native (RED).
ClocklessController_ezWS2812_GPIO_39MHz and _78MHz, added and shown, build in normal and forced mode.
ci/tests/test_mgm240_forced_software_pins.py: checks the macro shape, the driver pin type and the forced FASTLED_NO_PINMAP definition. It passes here; its first three cases fail on the original headers.
Tests and lint:bash lint exits 0. bash test --cpp passes (361/361 unit).
Probes: the Blink sketch was restored after each probe; none of it is committed.
No device run: no hardware run, no waveform or timing check, and no LOW-at-init, reuse or ordering proof on the selected software implementation.
No managed gate: the managed audit gate and artifact binding are not provided.
Limits
Drivers stay native: in forced mode the clockless and ezWS2812 drivers keep native GPIO by design.
Placeholder macros remain: they are documented as such and are no longer reached by any FastLED pin path.
Summary by CodeRabbit
Bug Fixes
Improved MGM240 compatibility when forced software-pin mode is enabled, while preserving the existing pin behavior when it is disabled.
Updated supported MGM240 LED output drivers to use the platform’s native pin handling, maintaining their existing timing and data transmission behavior.
Improved handling of pin-map configuration in forced software-pin mode.
MGM240 now provides a native pin type for clockless drivers while allowing FASTLED_FORCE_SOFTWARE_PINS to leave FastPin on its software implementation. The changes also set FASTLED_NO_PINMAP in forced mode when it is not already defined, and add text-based checks for these selections.
Changes: MGM240 pin selection and clockless drivers
Layer / File(s)
Summary
Native pin type and forced-mode selection src/platforms/arm/mgm240/fastpin_arm_mgm240.h, src/platforms/arm/mgm240/led_sysdefs_arm_mgm240.h, ci/tests/test_mgm240_forced_software_pins.py
Mgm240HwPin provides native pin access. _FL_DEFPIN specializes FastPin from the native type only when software pins are not forced. Forced mode updates hardware-support macros and defines FASTLED_NO_PINMAP if needed. Tests check the conditional specialization and configuration.
Clockless drivers use native pins src/platforms/arm/mgm240/clockless_arm_mgm240.h, src/platforms/arm/mgm240/clockless_ezws2812_39mhz.h, src/platforms/arm/mgm240/clockless_ezws2812_78mhz.h, ci/tests/test_mgm240_forced_software_pins.py
The MGM240 clockless and ezWS2812 drivers use Mgm240HwPin for pin setup and GPIO access. The bit timing sequences remain unchanged. Tests check that the listed drivers use the native pin type.
FastLED/FastLED#5072 — Addresses the MGM240 native FastPin specialization that could bypass forced software-pin selection.
FastLED/FastLED#5056 — Selects the shared forced software-pin implementation on MGM240; the issue also covers fallback correctness and the software SPI route.
FastLED/FastLED#5024 — Addresses the MGM240 forced-selection finding described in the software SPI audit.
Possibly related PRs
FastLED/FastLED#5105 — Defines the MGM240 native pin implementation that this change uses separately from forced-mode FastPin.
FastLED/FastLED#5149 — Applies a similar forced-software pin selection change for nRF52 while retaining a native pin type for drivers.
FastLED/FastLED#5150 — Applies a similar forced-software pin selection change for GIGA while retaining native clockless output.
Merge Risk: Moderate · up to b6396
Forced software-pin operations can disagree with clockless output about which physical pin to drive, and native initialization can make the next toggle ineffective. Resolve these inconsistencies and the repository-standard violations before merging.
- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Change in examples/Blink per target. The left number is this PR's image flash / attributed RAM in bytes; the colored delta is the change from the merge base (red ↑ is larger, green ↓ is smaller, 0 is unchanged).
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
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.
Part of #5072 (does not close it; see "Not met"). Part of #5024.
On MGM240,
FASTLED_FORCE_SOFTWARE_PINShad no effect._FL_DEFPINinfastpin_arm_mgm240.hexplicitly specializedfl::FastPin<PIN>, which overrides the forced software primary template infastpin_base.h.Fix
_FL_DEFPINnow always emitsfl::Mgm240HwPin<PIN>, the native P_SET/P_CLR_ARMPIN. It adds theFastPin<PIN>specialization only when software pins are not forced.Mgm240HwPin<DATA_PIN>. A software pin cannot meet their cycle-counted timing.portOutputRegister; a probe build confirmed it. TheportOutputRegister/digitalPinToPortfallbacks inled_sysdefs_arm_mgm240.hare placeholders, not EFR32MG24 GPIO addresses, so the register-based software pin would write to unrelated memory. Forced mode therefore also definesFASTLED_NO_PINMAP, which makesFastPintheNoPinMapPin.NO_HARDWARE_PIN_SUPPORT.Evidence
bash compile mgm240):Blinkprobe statically asserts:FastPin<2|3|4|5|13>derives from;NoPinMapPin;Mgm240HwPin<N>is native in every mode.FASTLED_NO_PINMAPall build with their expected selection.ClocklessController_ezWS2812_GPIO_39MHzand_78MHz, added and shown, build in normal and forced mode.main_*object, because fbuild does not rebuildmain.cppwhen only the sketch changes (Incremental build reuses main.cpp object when only the included sketch .ino changes fbuild#1948).ci/tests/test_mgm240_forced_software_pins.py: checks the macro shape, the driver pin type and the forcedFASTLED_NO_PINMAPdefinition. It passes here; its first three cases fail on the original headers.bash lintexits 0.bash test --cpppasses (361/361 unit).Blinksketch was restored after each probe; none of it is committed.Not met from #5072
Limits
Summary by CodeRabbit