Skip to content

feat(channels): TransportHint enum — Auto/OneShot/IsrStream/CpuPoll (default Auto=0) on Channel #3185

Closed as not planned

Description

@zackees

Goal

Add a per-channel TransportHint enum that lets sketches express how the driver should deliver bytes to the peripheral — one-shot block DMA, ISR-chunked streaming, or CPU-polled streaming.

API

namespace fl {

// 0 = auto. Driver picks based on platform capabilities + memory
// pressure + the channel's pixel count. Today auto resolves to
// IsrStream on platforms that support it; falls back to OneShot
// elsewhere.
enum class TransportHint : u8 {
    Auto      = 0,  // default — let the driver choose
    OneShot   = 1,  // block-DMA: allocate full frame buffer up front
    IsrStream = 2,  // ring-buffer + half/done-transfer ISR refill
    CpuPoll   = 3,  // CPU tightly polls the peripheral; no DMA
};

}  // namespace fl

Setter on Channel:

class Channel {
public:
    void setTransportHint(TransportHint hint) FL_NOEXCEPT;
    TransportHint getTransportHint() const FL_NOEXCEPT;
    // ...
};

Default: Auto (numerically zero — default-constructed channels get the right behavior automatically).

Behavior contract

Hint What the driver does RAM cost When to pick
Auto Driver picks. Today resolves to IsrStream on PARLIO/I2S; OneShot on RMT5/SPI/FlexIO until #3177 conversions land; CpuPoll on platforms without DMA (LPC8xx, AVR). best for platform always, unless you have a specific reason
OneShot Allocate full-frame buffer, hand to single DMA transaction, wait for completion. full frame (~3 bytes × N LEDs) small frames where streaming overhead isn't worth it; backward-compat with pre-#3177 behavior
IsrStream Allocate small ring buffer (~2-4 wave8 chunks), DMA shifts chunks, half/done-transfer ISR refills mid-frame. ~2 chunks × wave8 size large frames or multi-channel sketches where the one-shot buffer would be expensive
CpuPoll CPU tight-loop writes to the peripheral data register; no DMA. minimal platforms without DMA (LPC8xx phase 0, AVR); or DMA-bug workarounds

Why an enum and not strings

  • Compile-time check — bad values don't reach the driver.
  • Smaller binary — no string-comparison code.
  • Self-documenting.
  • 0 = Auto makes default-construction the right answer everywhere.

On naming — is "TransportHint" the right name?

Alternatives considered:

  • StreamingHint — implies all options stream, but OneShot doesn't.
  • DeliveryHint — clearer but verbose.
  • DmaMode — excludes CpuPoll.
  • TransportMode — drop "Hint" since it's not really a hint (it's a directive when set non-Auto).

Recommendation: TransportHint — captures "how the bytes get transported to the peripheral" without committing to a specific mechanism. Open to bikeshed in review.

Why this is separate from rendering-hint

TransportHint controls how the driver delivers bytes to the peripheral (DMA shape, RAM footprint).
RenderingHint (separate issue) controls when FastLED.show() returns to the caller (sync vs async).

The two are orthogonal:

TransportHint × RenderingHint Meaning
Auto × Auto Best defaults everywhere. Recommended for users who don't care.
OneShot × Sync Old-school FastLED behavior — block-DMA, show() waits.
OneShot × Async Block-DMA but show() returns after enqueue.
IsrStream × Sync Streaming transport, but block until the wire is done. Rare but legal.
IsrStream × Async The headline modern path: streaming + async.
CpuPoll × Sync The only sensible CpuPoll mode — CPU tight loop, blocks by definition.
CpuPoll × Async Illegal in practice; driver should clamp to Sync.

Acceptance

  • fl::TransportHint enum defined with Auto = 0, OneShot = 1, IsrStream = 2, CpuPoll = 3.
  • Channel::setTransportHint(...) + getter; default-constructed channels report Auto.
  • Each driver's show() honors the hint:
  • Drivers that can't honor a non-Auto hint silently fall back to their closest equivalent — document fallback behavior in the header.
  • Test that Auto on PARLIO/I2S today resolves to IsrStream; on RMT5/SPI/FlexIO it resolves to OneShot until those drivers ship the streaming conversion under [meta] ISR-chunked streaming conversion for clockless / clocked drivers #3177.

Initial driver support matrix

What each driver supports as of issue filing:

Driver Auto OneShot IsrStream CpuPoll
ESP32 PARLIO ✅ → IsrStream ✅ ✅ ❌
ESP32 I2S ✅ → IsrStream ✅ ✅ ❌
ESP32 RMT5 ✅ → OneShot ✅ ❌ (filed in #3178) ❌
ESP32 SPI ✅ → OneShot ✅ ❌ (filed in #3179) ❌
ESP32-S3 LCD_CLOCKLESS ✅ → OneShot ✅ ❌ (filed in #3180) ❌
Teensy 4 FlexIO ✅ → OneShot ✅ ❌ (filed in #3181) ❌
Teensy 4 ObjectFLED ✅ → OneShot ✅ ❌ (investigation in #3183) ❌
Teensy 4 LPUART ✅ → OneShot ✅ (lands in #3157) ❌ (filed in #3182) ❌
LPC8xx ✅ → CpuPoll ❌ ❌ ✅
AVR ✅ → CpuPoll ❌ ❌ ✅

Out of scope

  • The rendering-hint API (sync vs async) — separate issue filed alongside.
  • Per-frame override — first version is per-channel only. Per-show()-call overrides are a future enhancement.

Cross-references

Activity

  1. zackees commented on Jun 16, 2026

    @zackees
    MemberAuthor

    Closing — premature. Per user direction, the ISR-streaming-chunk vs one-shot vs CPU-poll transport decision should not be locked in right now. Re-file when the per-driver streaming conversions under #3177 have shaken out enough to define a stable taxonomy.

  2. moved this from Triage to Done in FastLED Trackeron Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions