Skip to content

docs(channels): refresh README for the #2428 dual-mode API - #2458

Merged
zackees merged 1 commit into
masterfrom
chore/channels-readme-refresh-2428
May 11, 2026
Merged

zackees merged 1 commit into
masterfrom
chore/channels-readme-refresh-2428

Conversation

@zackees

@zackees zackees commented May 11, 2026 •

Copy link
Copy Markdown
Member

Summary

The Channel API README hadn't been updated since #2435 (Phase 3a, ~10 PRs ago). This refresh aligns the docs with what the code actually does today after #2437 / #2438 / #2441 / #2448 / #2449 / #2450 / #2451 / #2454 / #2456.

Reviewed in three independent sub-agent passes to maximize coverage.

What's now documented (was missing or wrong)

New section Source-of-truth header
`fl::Bus` enum, `busName(Bus)`, `isKnownBusName()`, `DefaultBus` `bus.h`
`BusTraits`, `BusSupports<B, Chipset>`, `enableDrivers<B...>()` `bus_traits.h`
Templated `Channel::create<fl::Bus B>(cfg)` / `FastLED.add<fl::Bus B>(cfg)` `channel.h`, `FastLED.h`
`TypedChannel<Bus, Chipset>` + `ChannelConfigOf` (Phase 3b) `channel_typed.h`, `config.h`
Runtime `FastLED.add(fl::Bus, cfg)` dispatch `FastLED.h`
`fl::enableAllDrivers()` + `FastLED.enableAllDrivers()` `all_drivers.h`
`FASTLED_DISABLE_LEGACY_DRIVER_REGISTRY` binary-size opt-in `bus.h`
One-shot affinity-miss diagnostic + `findDriverByName()` (#2456) `channel.cpp.hpp`, `manager.h`
Two-mode dispatch architecture (compile-time Bus binding vs runtime registry) overview
Driver-name rename callout: `BITBANG`→`BIT_BANG`, `FLEXIO`→`FLEX_IO`, `OBJECTFLED`→`OBJECT_FLED` platform driver `getName()`

Bugs in the prior README that this fixes

  • Snippet referenced nonexistent `EngineState::READY` — actual type is `IChannelDriver::DriverState::READY`.
  • Override-engine examples called nonexistent `FastLED.setDriverPriority(...)` — the method lives only on `ChannelManager::setDriverPriority`; `CFastLED` exposes `setDriverEnabled` / `setExclusiveDriver` / `isDriverEnabled` but not `setDriverPriority`. Both call sites rewritten with the correct API and an explanatory comment about the asymmetry.
  • Registration example used the obsolete 3-arg `addDriver(priority, driver, "name")` form. Updated to the current 2-arg `addDriver(priority, driver)` — the name comes from `driver->getName()`.
  • Several affinity-string examples used the old driver names (`"BITBANG"` etc.); all migrated to the new spellings.
  • Two example snippets referenced an unanchored `leds` identifier — added file-scope `CRGB leds[60];` so they actually compile.
  • The three "Override Methods" were sequenced as if you'd call them in order; added an "alternatives, not a sequence" clarifier.
  • Verified the `Bus::AUTO` story end-to-end — no example shows `FastLED.addfl::Bus::AUTO(cfg)` (which would fail the feat(channels): templated Channel::create<Bus B>() / FastLED.add<Bus B>() (#2428, closes #2167) #2451 static_assert); only the legal forms (implicit default via `ChannelConfigOf` and the runtime `FastLED.add(fl::Bus::AUTO, cfg)` form) appear.

Review methodology

Three independent sub-agent passes, each with its own framing prompt:

  1. Broad accuracy — read the README, list of merged PRs, and the canonical API headers; identify and fix everything inaccurate or missing.
  2. Adversarial verification — fresh agent (no carryover from pass 1's framing) picked 5 random code snippets and verified each one would actually compile against the current headers; caught the two real bugs above.
  3. Polish — read end-to-end as a new user; fixed the unanchored `leds` / sequenced-Override-Methods narrative issues.

Test plan

  • `bash lint` — clean (Python, C++, JavaScript checks all pass).
  • No code changes; only `src/fl/channels/README.md` is touched.

Files changed (1)

  • `src/fl/channels/README.md` (+181, −23)

Related

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • Documentation
    • Expanded FastLED Channels API documentation with detailed sections on compile-time and runtime bus selection
    • Added driver registration guidance and updated hardware engine selection documentation
    • Improved advanced documentation examples and extended reference headers list

Review Change Stack

…bleAllDrivers + diagnostics)

The channels README hadn't been updated since #2435 (Phase 3a) while the
real API surface grew through #2437/2438/2441/2448/2449/2450/2451/2454/
2456. This refresh aligns the docs with what the code actually does today.

Reviewed in three independent sub-agent passes:

- Pass 1 (broad accuracy): added the new dual-mode dispatch architecture
  section (compile-time `fl::Bus` binding vs runtime `ChannelManager`),
  the templated `Channel::create<Bus B>(cfg)` / `FastLED.add<Bus B>(cfg)`
  examples, the `ChannelConfigOf<Chipset>` + `TypedChannel<Bus, Chipset>`
  Phase 3b API, the `enableDrivers<>()` / `enableAllDrivers()` opt-in
  registry, the `FASTLED_DISABLE_LEGACY_DRIVER_REGISTRY` binary-size
  macro, the one-shot affinity-miss diagnostic (#2456), and the
  driver-name rename callout (BITBANG -> BIT_BANG, FLEXIO -> FLEX_IO,
  OBJECTFLED -> OBJECT_FLED). Updated the registration example to the
  current 2-arg `addDriver(priority, driver)` signature; the name comes
  from `driver->getName()`. Expanded the Reference section to list the
  new headers (`bus.h`, `bus_traits.h`, `all_drivers.h`, `channel_typed.h`,
  `ichannel.h`) and to include `findDriverByName` / `clearAllDrivers` on
  `manager.h`.

- Pass 2 (independent verification): fixed two real bugs the first pass
  left in place. (a) DMA wait-pattern snippet referenced a nonexistent
  `EngineState::READY` — corrected to `IChannelDriver::DriverState::READY`.
  (b) "Overriding Engine Selection" examples called a nonexistent
  `FastLED.setDriverPriority(...)` — the method lives only on
  `ChannelManager::setDriverPriority`; rewrote both call sites to
  `fl::ChannelManager::instance().setDriverPriority(...)` with an
  explanatory comment about the API asymmetry vs the
  `setDriverEnabled` / `setExclusiveDriver` helpers that DO have
  CFastLED forwarders.

- Pass 3 (polish): added missing file-scope `CRGB leds[60];` declarations
  to two example snippets that referenced `leds` without anchoring it.
  Inserted an "alternatives, not a sequence" clarifier above the three
  Override Methods so a careful reader doesn't think calling all three in
  order is intended. Verified the `Bus::AUTO` story end-to-end:
  `FastLED.add<fl::Bus::AUTO>(cfg)` never appears as an example (the
  static_assert from #2451 rejects it); only `FastLED.add(cfg)` (implicit
  default via `ChannelConfigOf`) and `FastLED.add(fl::Bus::AUTO, cfg)`
  (runtime form, clears affinity) are shown.

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

coderabbitai Bot commented May 11, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR updates the FastLED Channels API README to document the dual dispatch model (compile-time fl::Bus binding vs. runtime selection), driver registration toggles, priority-based engine selection, custom driver patterns, and affinity-based diagnostic behavior. All changes are documentation-only.

Changes

Channels API Documentation

Layer / File(s) Summary
Architecture Overview
src/fl/channels/README.md
Dual dispatch model: compile-time Bus binding via FastLED.add<fl::Bus::X>(cfg) with linker-driven stripping, versus runtime selection with compile-time mismatch enforcement.
Compile-Time Bus Selection
src/fl/channels/README.md
New section documents fl::Bus canonical names, busName()/isKnownBusName() utilities, typed ChannelConfigOf<Chipset> enforcement, and BusSupports compile-time checks.
Driver Registration & Toggle
src/fl/channels/README.md
Expanded documentation of FASTLED_DISABLE_LEGACY_DRIVER_REGISTRY: legacy auto-registration disabled; clockless pre-bound; runtime requires enableAllDrivers() or enableDrivers<fl::Bus::X...>().
Engine/Priority Selection
src/fl/channels/README.md
Engine override example and control methods updated to show priority changes via fl::ChannelManager::instance().setDriverPriority(...) (FastLED no longer exposes forwarder).
Custom Driver Registration
src/fl/channels/README.md
Example registration changed to use ChannelManager::instance().addDriver(priority, driver) pattern; documents rejection/warnings when getName() is empty.
Dispatch Algorithm & Affinity Diagnostics
src/fl/channels/README.md
Engine selection algorithm: silent findDriverByName() on affinity; one-shot FL_ERROR on miss; fallback to priority-based canHandle() iteration. Exact driver-name spelling guidance added.
Non-blocking Wait & Driver State
src/fl/channels/README.md
Non-blocking "show() wait" guidance updated to use DriverState::READY and rely on poll() for state-machine progression.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related issues

  • FastLED/FastLED#2453: Documentation explicitly describes dual-mode dispatch (compile-time templated Bus binding vs. runtime selection after enableAllDrivers()), driver registration semantics, and affinity/dispatch fallback behavior.
  • FastLED/FastLED#2428: README documents compile-time fl::Bus/ChannelConfig, driver registration toggles, ChannelManager addDriver/setDriverPriority, and DriverState::READY semantics.

Possibly related PRs

  • FastLED/FastLED#2451: README documents compile-time Bus binding, busName(), Channel::create(), and FastLED.add() features.
  • FastLED/FastLED#2438: README documents FASTLED_DISABLE_LEGACY_DRIVER_REGISTRY opt-in, BusTraits unification, runtime enableDrivers, and ChannelManager semantics.
  • FastLED/FastLED#2456: README describes compile-time/runtime bus model, one-shot affinity-miss diagnostic, normalized bus names, and driver registration/priority behavior.

Poem

🐰 A readme so clear, let the channels now shine,
Bus binding at compile-time, or runtime by design,
Drivers register, priorities align,
One-shot diagnostics when affinity doesn't sign,
The docs now explain what the code had in mind!

🚥 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 PR title 'docs(channels): refresh README for the #2428 dual-mode API' clearly and accurately summarizes the main change—updating the channels README to reflect the dual-mode API documented in issue #2428. It is concise, specific, and directly related to the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/channels-readme-refresh-2428

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.

🧹 Nitpick comments (1)
src/fl/channels/README.md (1)

255-255: Consider documenting the two valid ChannelConfig constructor forms.

The README shows two distinct constructor patterns:

  • ChannelConfig(pin, timing, span, order) (lines 255, 429, 478, 484)
  • ChannelConfig(ClocklessChipset(pin, timing), span, order) (lines 52, 138)

Both forms are valid API usage (confirmed by test files), but the documentation would benefit from a brief explanation of when to use each form. For example, the first form is more concise for simple clockless setups, while the second form may be useful when working with chipset objects directly or when using named channel configurations.

🤖 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/fl/channels/README.md` at line 255, The README currently shows one
ChannelConfig usage but doesn't explain the two valid constructor forms; add a
short note describing both ChannelConfig(pin, timing, span, order) and
ChannelConfig(ClocklessChipset(pin, timing), span, order) constructors, explain
when to use each (e.g., the direct pin form for concise/simple clockless setups
and the ClocklessChipset form when you need chipset objects or named channel
configurations), and include mentions of the related symbols used in examples
such as ChannelConfig, ClocklessChipset, fl::span, CRGB, and RGB so readers can
easily map the examples to the API.
🤖 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.

Nitpick comments:
In `@src/fl/channels/README.md`:
- Line 255: The README currently shows one ChannelConfig usage but doesn't
explain the two valid constructor forms; add a short note describing both
ChannelConfig(pin, timing, span, order) and ChannelConfig(ClocklessChipset(pin,
timing), span, order) constructors, explain when to use each (e.g., the direct
pin form for concise/simple clockless setups and the ClocklessChipset form when
you need chipset objects or named channel configurations), and include mentions
of the related symbols used in examples such as ChannelConfig, ClocklessChipset,
fl::span, CRGB, and RGB so readers can easily map the examples to the API.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d142842a-556b-461f-a9c4-3c46f46ff47e

📥 Commits

Reviewing files that changed from the base of the PR and between b089be8 and 7ab1ef9.

📒 Files selected for processing (1)
  • src/fl/channels/README.md

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.

1 participant