Skip to content

feat(lpc): LPC845 Arduino serial I/O + pin dispatch (supersedes #2996) - #2997

Merged
zackees merged 3 commits into
masterfrom
feat/lpc845-port
Jun 13, 2026
Merged

zackees merged 3 commits into
masterfrom
feat/lpc845-port

Conversation

@zackees

@zackees zackees commented Jun 13, 2026 •

Copy link
Copy Markdown
Member

Supersedes #2996.

Rebases the core src/ changes from @phatpaul's WIP PR #2996 onto current master, which has since absorbed most of the LPC port (bare-metal support in #2989/#2992/#2995). Original commit authorship preserved.

What changed vs #2996

Most of #2996's src/ edits were already merged into master in a more complete form (clockless driver, led_sysdefs, unity build). What remains genuinely additive:

  • io_lpc.cpp.hpp — adds the Arduino Serial-backed I/O implementation under #if defined(ARDUINO), while preserving master's bare-metal stub path for non-Arduino builds (so lpc: move bare-metal support into platform code #2989's bare-metal support is not regressed).
  • pin.h — routes LPC parts (LPC845/804/11U/15/11-legacy) to platforms/shared/pin_noop.hpp.
  • FastLED.cpp.hpp — skips the __cxa_pure_virtual definition under ARDUINO (the Arduino core already provides it).

Dropped from #2996

  • The examples/BlinkLPC845Arduino/ and examples/BlinkLPC845CMSIS/ sketches (kept out of the example/CI matrix per project policy).
  • A duplicate #include "fastspi_types.h" in spi_arm_lpc.h and a commented-out unused-variable block in the shared m0clockless_c.h — both noise that's unnecessary against current master.

Also included

  • fix(lint): added the missing // IWYU pragma: private to two pre-existing channel_poll_signal headers that were failing bash lint --cpp on master.

Notes

Per #2996, Serial on real hardware was still WIP at the time. This PR keeps the implementation compile-gated to Arduino LPC builds and does not touch the native test path.

🤖 Generated with Claude Code

Co-authored-by: Paul Abbott [email protected]

Summary by CodeRabbit

  • Improvements

    • Enhanced Arduino platform support for LPC I/O operations, enabling Serial communication for read, write, and buffered operations with line reading and timeout handling.
  • Refactor

    • Refined platform code organization and expanded ABI guard conditions for improved cross-platform compatibility.

zackees and others added 2 commits June 12, 2026 23:37
Rebase of the core src changes from #2996 (phatpaul) onto current master,
which already carries the bare-metal LPC port. Drops the example sketches.

- io_lpc: add Arduino Serial-backed implementation under `#if ARDUINO`,
  preserving master's bare-metal stub path for non-Arduino builds
- pin.h: route LPC parts to platforms/shared/pin_noop.hpp
- FastLED.cpp.hpp: skip the __cxa_pure_virtual definition under ARDUINO
  (provided by the Arduino core)

Co-authored-by: Paul Abbott <[email protected]>
These two platform headers were missing the `// IWYU pragma: private`
marker, failing the cpp lint check on master.
@zackees zackees mentioned this pull request Jun 13, 2026
@coderabbitai

coderabbitai Bot commented Jun 13, 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: def27f93-0bb3-4cfb-8aa9-b11207bb278d

📥 Commits

Reviewing files that changed from the base of the PR and between f70892f and 90a4814.

📒 Files selected for processing (1)
  • src/platforms/arm/lpc/io_lpc.cpp.hpp

📝 Walkthrough

Walkthrough

This PR adds Arduino Serial API support for LPC platforms when the ARDUINO define is present, expands the ABI guard to cover Arduino builds, and annotates headers with IWYU pragmas. The LPC I/O implementation includes timeout-based readline with delimiter support and fallback stub behaviors for bare-metal scenarios.

Changes

LPC Arduino Serial Support

Layer / File(s) Summary
Arduino ABI guard refinement
src/FastLED.cpp.hpp
The __cxxabiv1 ABI guard now excludes the __cxa_pure_virtual stub when ARDUINO is defined, in addition to existing ESP8266/ESP32 exclusions.
LPC Arduino Serial I/O implementation
src/platforms/arm/lpc/io_lpc.cpp.hpp
Conditional Arduino-backed LPC I/O wrappers delegate to Arduino Serial for begin, print, println, available, peek, read, write_bytes, and flush when ARDUINO is defined. A hand-rolled readLineNative() function reads from Serial until a delimiter or 1s timeout, yielding while waiting and writing NUL-terminated output. Bare-metal implementations remain in the #else branch.
Include-What-You-Use pragma annotations
src/platforms/esp/32/channel_poll_signal_esp32.h, src/platforms/shared/channel_poll_signal.h
IWYU pragma comments mark channel poll signal headers as private for static analysis tooling.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • FastLED/FastLED#2989: Both PRs touch the ARM LPC I/O glue in src/platforms/arm/lpc/io_lpc.cpp.hpp, with this PR extending it for ARDUINO mode while PR #2989 introduces the LPC platform I/O integration stubs.

Poem

🐰 With Arduino's Serial call,
The LPC boards now work for all,
Read lines with patience, timeout-bound,
And build tools know which headers round,
The FastLED glow shines everywhere! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% 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 primary changes: adding Arduino serial I/O support and pin dispatch for LPC845, with a reference to the superseded PR.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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/lpc845-port

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: 3

🤖 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/lpc/io_lpc.cpp.hpp`:
- Line 60: Replace bare Arduino millis() calls with the prefixed fl::millis() in
this file: change the assignment unsigned long start = millis(); (and the other
occurrences of millis() flagged by the review) to use fl::millis() so the code
uses the project's fl:: prefixed timing API consistently.
- Line 67: Replace the bare call to yield() with fl::yield() so the code uses
the project's prefixed helper; locate the call to yield() in io_lpc.cpp.hpp and
change it to fl::yield(), leaving surrounding logic intact.

In `@src/platforms/pin.h`:
- Around line 44-46: Remove the redundant LPC-specific `#elif` branch that
includes "platforms/shared/pin_noop.hpp" for macros FL_LPC845, FL_LPC804,
FL_LPC11_USB, FL_LPC15, and FL_LPC11_LEGACY because FL_IS_ARM_LPC already covers
those variants; specifically delete the conditional block that tests "`#elif`
defined(FL_LPC845) || defined(FL_LPC804) || defined(FL_LPC11_USB) ||
defined(FL_LPC15) || defined(FL_LPC11_LEGACY)" and its include of
"platforms/shared/pin_noop.hpp" so the existing FL_IS_ARM_LPC branch and its
selection of pin_noop.hpp remain the single source of truth.
🪄 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: ac80aaa6-c03d-48bc-b66d-841bb513d71d

📥 Commits

Reviewing files that changed from the base of the PR and between 356a379 and f70892f.

📒 Files selected for processing (5)
  • src/FastLED.cpp.hpp
  • src/platforms/arm/lpc/io_lpc.cpp.hpp
  • src/platforms/esp/32/channel_poll_signal_esp32.h
  • src/platforms/pin.h
  • src/platforms/shared/channel_poll_signal.h

Comment thread src/platforms/arm/lpc/io_lpc.cpp.hpp Resolved
Comment thread src/platforms/arm/lpc/io_lpc.cpp.hpp Resolved
Comment thread src/platforms/pin.h Resolved
…n dispatch

- io_lpc: use fl::millis()/fl::yield() instead of bare Arduino calls, per
  project guidelines; add the chrono.h / yield.h includes
- pin.h: remove the redundant LPC variant #elif branch — FL_IS_ARM_LPC
  (which rolls up FL_LPC845/804/11/15) already routes to pin_noop.hpp
@zackees
zackees merged commit 62c9e01 into master Jun 13, 2026
19 of 20 checks passed
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Jun 13, 2026
@zackees

zackees commented Jun 13, 2026

Copy link
Copy Markdown
Member Author

Follow-up: the LPC linker-script path-resolution issue noted during the rebase (why the example shipped a copied .ld) is now fixed upstream in the platform builder — FastLED/platform-nxp-lpc8xx#4 (closes FastLED/platform-nxp-lpc8xx#3). Projects can reference the stock framework linker script directly; no copied .ld needed.

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.

1 participant