Repository navigation
feat(nrf52): add FASTLED_NRF52_ALLOW_NFC_PINS / _USR_LED opt-ins (#2446) - #2447
Conversation
Resolves #2446 by introducing two compile-time switches that re-enable pins which are by default declared _FL_DEF_INVALID_PIN on the SuperMini, nice!nano v2, nRFMicro, XIAO nRF52840, and XIAO nRF52840 Sense variant blocks in src/platforms/arm/nrf52/fastpin_arm_nrf52_variants.h. - FASTLED_NRF52_ALLOW_NFC_PINS: P0.09 / P0.10 (NFC1/NFC2) become valid output pins. The macro is necessary but not sufficient -- users also need CONFIG_NFCT_PINS_AS_GPIOS=1 in the BSP, or to call the Adafruit nRF52 core's NFC_PINS_AS_GPIO() at boot, for the pins to actually drive a strip. - FASTLED_NRF52_ALLOW_USR_LED: on-board user-LED pins become valid output pins (P0.15 SuperMini/nice!nano v2, P1.10 nRFMicro, and the three XIAO RGB LEDs at P0.26 / P0.06 / P0.30). EXT_VCC enable pins (P0.13 SuperMini/nice!nano v2, P1.09 nRFMicro), VBAT-sense pins (P0.04 nRFMicro, P0.14/P0.31 XIAO), HICHG / ~CHG, and QSPI flash pins remain invalid unconditionally per the decision matrix in #2446. Implementation: - Two new helper macros _FL_DEFPIN_NFC and _FL_DEFPIN_USR_LED expand to either _FL_DEFPIN or _FL_DEF_INVALID_PIN based on whether the user defined the corresponding FASTLED_NRF52_ALLOW_* switch. - Each affected line in the five variant blocks swaps _FL_DEF_INVALID_PIN for the appropriate helper. No other lines are touched (EXT_VCC, VBAT, HICHG, ~CHG, QSPI stay invalid). - README.md in src/platforms/arm/nrf52/ documents both new macros. The default behaviour is unchanged: without the macros defined, the same set of pins remains invalid as before this commit. Closes #2446 Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
📝 WalkthroughWalkthroughThis PR introduces two conditional pin-validity macros for nRF52840 boards: ChangesnRF52 Conditional Pin Enablement
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/platforms/arm/nrf52/fastpin_arm_nrf52_variants.h`:
- Around line 67-69: The comment claiming the NFC pins apply to “every nRF52840
variant in this file” is inaccurate because only the variant blocks guarded by
the build-time switch _FL_DEFPIN_NFC expose P0.09/P0.10 (NFC1/NFC2) as FastLED
pins; update the wording in the comment to explicitly state that P0.09/P0.10
become valid FastLED pins only for the variants controlled by the _FL_DEFPIN_NFC
switch (or similar phrasing naming the macro) so the text matches the
implementation.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: fa990dc4-716e-4b07-ab8c-6f588fa4a8b8
📒 Files selected for processing (2)
src/platforms/arm/nrf52/README.mdsrc/platforms/arm/nrf52/fastpin_arm_nrf52_variants.h
| // When defined by the user, P0.09 / P0.10 (NFC1 / NFC2) become valid | ||
| // FastLED output pins on every nRF52840 variant in this file. The pins | ||
| // are gated behind a build-time switch because the Adafruit nRF52 core |
There was a problem hiding this comment.
NFC scope wording is broader than implementation
Line 68 says this applies on “every nRF52840 variant in this file,” but only selected variant blocks were switched to _FL_DEFPIN_NFC. Tightening this wording avoids misleading users about board coverage.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/platforms/arm/nrf52/fastpin_arm_nrf52_variants.h` around lines 67 - 69,
The comment claiming the NFC pins apply to “every nRF52840 variant in this file”
is inaccurate because only the variant blocks guarded by the build-time switch
_FL_DEFPIN_NFC expose P0.09/P0.10 (NFC1/NFC2) as FastLED pins; update the
wording in the comment to explicitly state that P0.09/P0.10 become valid FastLED
pins only for the variants controlled by the _FL_DEFPIN_NFC switch (or similar
phrasing naming the macro) so the text matches the implementation.
Summary
Resolves #2446 by introducing two compile-time switches that re-enable pins which are by default declared
_FL_DEF_INVALID_PINon the SuperMini, nice!nano v2, nRFMicro, XIAO nRF52840, and XIAO nRF52840 Sense variant blocks insrc/platforms/arm/nrf52/fastpin_arm_nrf52_variants.h.FASTLED_NRF52_ALLOW_NFC_PINS:P0.09/P0.10(NFC1/NFC2) become valid FastLED output pins on every nRF52840 variant block in this file. The macro is necessary but not sufficient — users also needCONFIG_NFCT_PINS_AS_GPIOS=1in the BSP/build flags, or a call to the Adafruit nRF52 core'sNFC_PINS_AS_GPIO()at boot, for the pins to actually drive a strip.FASTLED_NRF52_ALLOW_USR_LED: on-board user-LED pins become valid FastLED output pins (P0.15SuperMini/nice!nano v2,P1.10nRFMicro, and the three XIAO RGB LEDs atP0.26/P0.06/P0.30).EXT_VCCenable pins (P0.13SuperMini/nice!nano v2,P1.09nRFMicro), VBAT-sense pins (P0.04nRFMicro,P0.14/P0.31XIAO), HICHG, ~CHG, and QSPI flash pins remain invalid unconditionally per the decision matrix in #2446 — toggling EXT_VCC mid-show()browns out the regulator, and the others are not safe for FastLED output.Implementation
_FL_DEFPIN_NFCand_FL_DEFPIN_USR_LEDexpand to either_FL_DEFPINor_FL_DEF_INVALID_PINbased on whether the user defined the correspondingFASTLED_NRF52_ALLOW_*switch._FL_DEF_INVALID_PINfor the appropriate helper. No other lines are touched (EXT_VCC, VBAT, HICHG, ~CHG, QSPI all stay invalid).src/platforms/arm/nrf52/README.mddocuments both new macros and reiterates the BSP-side requirement for the NFC opt-in.Default behaviour
Unchanged. Without either macro defined, exactly the same set of pins remains invalid as before this PR. The opt-ins are strictly additive.
Test plan
bash lint --cpppassesbash test --cpppasses (302/302)Closes #2446
Co-Authored-By: Claude Opus 4.7 (1M context) [email protected]
Summary by CodeRabbit
New Features
Documentation