Repository navigation
Description
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 flSetter 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 = Automakes default-construction the right answer everywhere.
On naming — is "TransportHint" the right name?
Alternatives considered:
StreamingHint— implies all options stream, butOneShotdoesn't.DeliveryHint— clearer but verbose.DmaMode— excludesCpuPoll.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::TransportHintenum defined withAuto = 0,OneShot = 1,IsrStream = 2,CpuPoll = 3. -
Channel::setTransportHint(...)+ getter; default-constructed channels reportAuto. - Each driver's
show()honors the hint:Auto: driver picks based on its capabilities.OneShot: force block-DMA path (today's default for most drivers).IsrStream: force streaming path (only valid where the driver has shipped the conversion under [meta] ISR-chunked streaming conversion for clockless / clocked drivers #3177).CpuPoll: force CPU-polled path (only valid where the driver supports it).
- Drivers that can't honor a non-Auto hint silently fall back to their closest equivalent — document fallback behavior in the header.
- Test that
Autoon PARLIO/I2S today resolves toIsrStream; on RMT5/SPI/FlexIO it resolves toOneShotuntil 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 (
syncvsasync) — separate issue filed alongside. - Per-frame override — first version is per-channel only. Per-
show()-call overrides are a future enhancement.
Cross-references
- Sibling: rendering-hint issue (filed alongside).
- Parent meta family: [meta] ISR-chunked streaming conversion for clockless / clocked drivers #3177 (ISR streaming).
- Reference: existing PARLIO + I2S streaming implementations.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
zackees commentedon Jun 16, 2026
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.