Skip to content

fix(nrf52): defer PCA10056 pin map when community TARGET_* override is set - #2627

Merged
zackees merged 3 commits into
masterfrom
fix/nrf52-supermini-pca10056-redef
May 31, 2026
Merged

zackees merged 3 commits into
masterfrom
fix/nrf52-supermini-pca10056-redef

Conversation

@zackees

@zackees zackees commented May 31, 2026 •

Copy link
Copy Markdown
Member

Summary

  • SUPERMINI_NRF52840, NICE_NANO_NRF52840, and NRFMICRO_NRF52840 all reuse the nrf52840_dk_adafruit BSP via ci/boards.py, so the Adafruit BSP auto-defines ARDUINO_NRF52840_PCA10056 alongside the community TARGET_* override.
  • Both pin-map blocks then defined fl::FastPin<0..>, tripping the #error "Cannot define more than one board at a time" guard plus C++ redefinition diagnostics — see the pre-fix CI run.
  • Gate the ARDUINO_NRF52840_PCA10056 block on a single __FASTLED_NRF52_USER_TARGET_OVERRIDE sentinel (set when any TARGET_* is in scope) so the explicit user override wins over the BSP-supplied default. No behavior change for any board that does not set one of the three TARGET_* macros.

Closes #2626.

Test plan

Reviewer follow-ups addressed

Pushed an iteration commit collapsing the three inline !defined(TARGET_*) guards into a single __FASTLED_NRF52_USER_TARGET_OVERRIDE sentinel after second-opinion review flagged the hand-maintained allowlist as a maintenance smell. Now adding a new community-board TARGET_* requires extending exactly one OR-chain.

🤖 Generated with Claude Code

…s set

SuperMini / nice!nano v2 / nRFMicro all reuse the nrf52840_dk_adafruit
BSP via ci/boards.py, so the Adafruit BSP auto-defines
ARDUINO_NRF52840_PCA10056 alongside the community TARGET_* override.
Both blocks then defined FastPin<0..>, tripping the #error guard and
producing redefinition diagnostics. Gate the PCA10056 block on the
absence of TARGET_SUPERMINI_NRF52840 / TARGET_NICE_NANO_V2 /
TARGET_NRFMICRO so the explicit override wins over the BSP default.

Closes #2626

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@coderabbitai

coderabbitai Bot commented May 31, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e17e4175-d982-417b-8841-141832a454b0

📥 Commits

Reviewing files that changed from the base of the PR and between 0df6f55 and 3dfa1c1.

📒 Files selected for processing (1)
  • .github/workflows/build_nrf52840_supermini.yml

📝 Walkthrough

Walkthrough

Adds a preprocessor sentinel that detects community nRF52 TARGET_* overrides and gates the ARDUINO_NRF52840_PCA10056 pin-mapping block so community-target mappings take precedence; also adds a manual workflow_dispatch trigger to the nrf52840_supermini GitHub Actions workflow.

Changes

nRF52 Board Pin-Mapping Priority

Layer / File(s) Summary
User-target sentinel
src/platforms/arm/nrf52/fastpin_arm_nrf52_variants.h
Adds __FASTLED_NRF52_USER_TARGET_OVERRIDE when TARGET_SUPERMINI_NRF52840, TARGET_NICE_NANO_V2, or TARGET_NRFMICRO is defined.
PCA10056 mapping guard for community targets
src/platforms/arm/nrf52/fastpin_arm_nrf52_variants.h
The ARDUINO_NRF52840_PCA10056 pin-mapping block now activates only when ARDUINO_NRF52840_PCA10056 is defined and __FASTLED_NRF52_USER_TARGET_OVERRIDE is not set; the __FASTPIN_ARM_NRF52_VARIANT_FOUND multi-board guard is moved inside this combined condition.

CI Workflow: nrf52840_supermini

Layer / File(s) Summary
Manual workflow dispatch
.github/workflows/build_nrf52840_supermini.yml
Adds workflow_dispatch under on: to allow manual triggering of the build workflow.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

Possibly related PRs

  • FastLED/FastLED#2445: Also updates fastpin_arm_nrf52_variants.h to prioritize community TARGET_* defines over PCA10056 mappings.
  • FastLED/FastLED#2354: Adds workflow_dispatch to a different build workflow; similar CI-trigger change.

Poem

🐰 I nudged the headers, soft and light,
told PCA10056 to yield the night,
SuperMini, nice!nano, nRFMicro stand tall,
no duplicated pins to make devs fall,
CI can run by hand — hooray, one and all.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: deferring the PCA10056 pin map when community TARGET_* overrides are set, directly addressing the root cause in issue #2626.
Linked Issues check ✅ Passed The pull request fully implements the required objective from #2626: gating the ARDUINO_NRF52840_PCA10056 block in fastpin_arm_nrf52_variants.h when community TARGET_* overrides are present, resolving the FastPin redefinition errors.
Out of Scope Changes check ✅ Passed The workflow_dispatch trigger addition to build_nrf52840_supermini.yml is a minor supporting change for CI/manual testing, complementary to the core fix and appropriately scoped.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/nrf52-supermini-pca10056-redef

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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`:
- Line 352: Update the inline comment that currently references issue `#2422` to
instead reference issue `#2626` so it correctly documents the gate fixing the
build failure from conflicting pin definitions; locate the comment containing
"PCA10056 pin map (see issue `#2422`)" in fastpin_arm_nrf52_variants.h and replace
the issue number with "`#2626`" while preserving the rest of the sentence and
context.
🪄 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: 5fba35f2-8bb8-4234-bf56-82b313cc2031

📥 Commits

Reviewing files that changed from the base of the PR and between 89cec49 and 30ace5b.

📒 Files selected for processing (1)
  • src/platforms/arm/nrf52/fastpin_arm_nrf52_variants.h

zackees and others added 2 commits May 30, 2026 17:52
Address review feedback on #2627: replace the three inline
!defined(TARGET_*) clauses on the PCA10056 guard with a single
__FASTLED_NRF52_USER_TARGET_OVERRIDE sentinel defined once at the top
of the file. Adding a new community-board TARGET_* now requires
extending exactly one OR-chain instead of editing every BSP-default
block that might need to defer to it.

Also documents the layering choice (header guard vs.
-UARDUINO_NRF52840_PCA10056 in ci/boards.py) — header-side guard works
for non-PlatformIO consumers who set TARGET_* by hand.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
The push-master-only trigger meant the FastPin redefinition fix on this
PR could not be exercised by CI until merge. Adding workflow_dispatch
lets us run the build against PR branches for pre-merge verification.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@zackees
zackees merged commit 23349cc into master May 31, 2026
6 of 7 checks passed
zackees added a commit that referenced this pull request May 31, 2026
…2638)

Follow-up to #2636. After switching `xiaoblesense_adafruit` to reuse the
`nrf52840_dk_adafruit` BSP variant (which defines
`ARDUINO_NRF52840_PCA10056`), the master post-merge build failed with
"#error Cannot define more than one board at a time": both the PCA10056
pin map block and the new TARGET_XIAOBLE block fired.

Same shape as PR #2627 fixed for SuperMini / nice!nano / nRFMicro. Add
`TARGET_XIAOBLE_NRF52840_SENSE` to the `__FASTLED_NRF52_USER_TARGET_OVERRIDE`
OR-chain at the top of `fastpin_arm_nrf52_variants.h` so the PCA10056
block stands down when the XIAO target is set.

Refs #2634 (#2636 post-merge run 26700041082).

Co-authored-by: Claude Opus 4.7 <[email protected]>
@zackees
zackees deleted the fix/nrf52-supermini-pca10056-redef branch August 21, 2026 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nrf52: supermini_nrf52840 fails to build — FastPin redefinition between PCA10056 default and TARGET_SUPERMINI_NRF52840

1 participant