Skip to content

feat(platform/lpc): scope LPC8xx driver code to LPC8xx-only (#2865) - #2866

Merged
zackees merged 1 commit into
masterfrom
feat/2865-lpc8xx-driver-scope-tighten
Jun 6, 2026
Merged

zackees merged 1 commit into
masterfrom
feat/2865-lpc8xx-driver-scope-tighten

Conversation

@zackees

@zackees zackees commented Jun 6, 2026 •

Copy link
Copy Markdown
Member

Closes #2865. Follow-up to #2849 (LPC11xx detection) and #2859 (LPC15xx detection); prep work tracked under #2845 Stage 4.

Summary

  • Tighten the _ARMPIN template gate in src/platforms/arm/lpc/fastpin_arm_lpc.h from FL_IS_ARM_LPC to FL_LPC845 || FL_LPC804.
  • Tighten the bit-banged ClocklessController gate in src/platforms/arm/lpc/clockless_arm_lpc.h to the same LPC8xx-specific predicate (the existing FL_LPC804 && FASTLED_LPC_PLU opt-out is preserved).
  • Add a clear #error in src/platforms/arm/lpc/fastled_arm_lpc.h for FL_LPC11 / FL_LPC15 builds, pointing at meta: LPC dev roadmap — Stages 3 + 4 (port completion, family expansion) #2845 Stage 4 as the tracking issue for driver wiring.
  • Refresh the LPC family comment block in src/platforms/arm/is_arm.h to reflect that LPC8xx, LPC11xx, and LPC15xx are all detected today (with driver scope still LPC8xx-only).

Why

The current FL_IS_ARM_LPC gate is family-level. With #2849 and #2859 having shipped LPC11xx and LPC15xx detection, an FL_LPC11 or FL_LPC15 build would silently compile against the LPC8xx GPIO controller layout (SET[0] / CLR[0] at 0xA0000000) even though LPC11xx ships the legacy GPIO at 0x50000000 with masked-access semantics (UM10398 §9, UM10462 §9) and LPC15xx ships a different controller again (UM11074). The architecture macros are likewise wrong: LPC11xx is Cortex-M0 (not M0+) and LPC15xx is Cortex-M3.

No platform configuration in-tree currently defines FL_LPC11 / FL_LPC15, so this PR has no behaviour change for shipping LPC8xx builds. It is a latent-bug fix that keeps the next LPC family scaffolds from accidentally activating LPC8xx code paths.

Out of scope (deliberately)

  • led_sysdefs_arm_lpc.h updates (FL_IS_ARM_M0 for LPC11xx, F_CPU defaults, CMSIS device headers). led_sysdefs_* files are blocked by protect_platform_headers.py; the override env var must be set at Claude Code launch.
  • New fastpin_arm_lpc11.h / clockless_arm_lpc11.h. Per the meta: LPC dev roadmap — Stages 3 + 4 (port completion, family expansion) #2845 second comment: "patterns are non-trivial to verify without hardware - prefer the maintainer add these once a board is in hand."

Test plan

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Added compile-time guards to prevent unsupported ARM microcontroller variant combinations, with helpful error messages guiding users to correct configurations.
  • Documentation

    • Enhanced platform detection documentation for ARM microcontroller families, clarifying variant-specific implementation details.

Tighten the family gates so `_ARMPIN` and the bit-banged `ClocklessController`
in `src/platforms/arm/lpc/` activate only for LPC845 / LPC804 instead of any
`FL_IS_ARM_LPC` build. With LPC11xx (Cortex-M0) and LPC15xx (Cortex-M3)
detection now landing via #2849 and #2859, the family-level gate would
silently compile LPC8xx-targeted GPIO controller layouts and M0+ ASM
selection for chips that ship a different GPIO controller (legacy GPIO at
0x50000000 with masked-access semantics on LPC11xx per UM10398 / UM10462;
GPIO per UM11074 on LPC15xx) and a different architecture (M0 not M0+ on
LPC11xx; M3 on LPC15xx).

Surface the gap with a clear `#error` in `fastled_arm_lpc.h` that points
LPC11xx / LPC15xx builds at #2845 Stage 4 as the tracking issue for the
follow-up driver wiring, and refresh the `is_arm.h` comment block so the
LPC family roll-up reflects what's actually detected today.

No behaviour change for in-tree LPC8xx builds (no platform configuration
currently defines `FL_LPC11` / `FL_LPC15`); this is a latent-bug fix that
keeps the next LPC family scaffolds from accidentally activating LPC8xx
code paths.

Closes #2865.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Jun 6, 2026 •

Copy link
Copy Markdown

PR changed again? Review this PR in Change Stack to compare snapshots and stay oriented.

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: c0b25e91-f248-4643-a104-6ddc98ab7204

📥 Commits

Reviewing files that changed from the base of the PR and between 94c4274 and fcc226f.

📒 Files selected for processing (4)
  • src/platforms/arm/is_arm.h
  • src/platforms/arm/lpc/clockless_arm_lpc.h
  • src/platforms/arm/lpc/fastled_arm_lpc.h
  • src/platforms/arm/lpc/fastpin_arm_lpc.h

📝 Walkthrough

Walkthrough

This PR narrows the LPC ARM driver scope to prevent wrong-family compilation. FastPin and Clockless drivers are restricted to LPC8xx (LPC845/LPC804), and compile-time errors are added for LPC11xx/LPC15xx builds. LPC detection documentation is clarified.

Changes

LPC8xx Driver Scoping

Layer / File(s) Summary
LPC detection documentation
src/platforms/arm/is_arm.h
is_arm.h LPC family comment is expanded to document that FL_IS_ARM_LPC detects LPC8xx, LPC11xx, and LPC15xx, each with different GPIO layouts and driver requirements.
LPC8xx-only driver gates and error handling
src/platforms/arm/lpc/fastpin_arm_lpc.h, src/platforms/arm/lpc/clockless_arm_lpc.h, src/platforms/arm/lpc/fastled_arm_lpc.h
FastPin and Clockless driver templates are regated from FL_IS_ARM_LPC to FL_LPC845/FL_LPC804 with updated comments; fastled_arm_lpc.h adds a compile-time #error to catch FL_LPC11/FL_LPC15 builds that would use wrong driver wiring.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

  • FastLED/FastLED#2841: The PR's explicit exclusion and mention of FASTLED_LPC_PLU for LPC804 relates to the proposed PLU-based LPC804 clockless driver gated by that same macro.
  • FastLED/FastLED#2836: Both directly modify LPC detection and driver selection in the same platform headers as part of the broader LPC8xx porting effort.
  • FastLED/FastLED#2845: The PR implements the Stage 4 acceptance criteria from this meta-issue: scoping LPC8xx drivers and preventing cross-family compilation errors.

Possibly related PRs

  • FastLED/FastLED#2859: This PR tightens LPC driver gates to prevent LPC15xx (added by #2859) from inheriting the LPC8xx FastPin and Clockless templates.
  • FastLED/FastLED#2849: This PR tightens LPC driver gates to prevent LPC11xx (added by #2849) from inheriting the LPC8xx FastPin and Clockless templates.

Poem

🐰 Nested guards keep drivers tight,
LPC families split just right—
Eight, Eleven, Fifteen too,
Each gets wiring made for you! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main objective: scoping LPC8xx-specific driver code to LPC8xx devices only, which is the core change across all modified files.
Linked Issues check ✅ Passed The pull request fully implements all coding requirements from issue #2865: restricted fastpin_arm_lpc.h and clockless_arm_lpc.h guards to FL_LPC845/FL_LPC804, added #error directive in fastled_arm_lpc.h, updated is_arm.h documentation, and bash test --cpp passes.
Out of Scope Changes check ✅ Passed All changes are directly aligned with issue #2865 requirements: tightening LPC family driver gating and adding error guards. No unrelated modifications to other platform code or functionality are present.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/2865-lpc8xx-driver-scope-tighten

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

feat(platform/lpc): scope LPC8xx driver code to LPC8xx-only (prep for #2845 Stage 4)

1 participant