Repository navigation
Closed as not planned
Closed as not planned
Copy link
Description
Goal
Add a per-channel RenderingHint enum that lets sketches say whether they want FastLED.show() (or the underlying channel.show()) to block until the wire is done or return as soon as DMA is enqueued.
API
namespace fl {
// 0 = auto. Driver picks whichever mode is best for the current
// platform + transport choice. On platforms / transports that support
// async (DMA-backed peripherals), auto resolves to Async; on
// platforms without DMA / where async is meaningless, auto resolves
// to Sync.
enum class RenderingHint : u8 {
Auto = 0, // default — let the driver choose
Sync = 1, // show() blocks until transmission is complete
Async = 2, // show() returns as soon as DMA is enqueued
};
} // namespace fl
Setter on Channel:
class Channel {
public:
void setRenderingHint(RenderingHint hint) FL_NOEXCEPT;
RenderingHint getRenderingHint() const FL_NOEXCEPT;
// ...
};
Default: Auto (numerically zero — uninitialized members get the right default automatically).
Why an enum and not strings
- Compile-time check — bad values are caught at the call site, not at runtime.
- Smaller binary — no string table, no comparison machinery.
- Self-documenting — `IDE autocomplete shows the three options instantly.
0 = Automakes default-construction the right answer everywhere.
Behavior contract
| Hint | show() semantics |
Frame-rate cost |
|---|---|---|
Auto |
Driver picks. On DMA peripherals → Async. On bitbang / CPU-polled → Sync. | best for platform |
Sync |
show() does not return until the wire transmission is done. |
possibly slower (CPU stalls during transmission) |
Async |
show() returns immediately after enqueueing DMA. Caller responsible for not calling show() again before the previous frame finishes (driver returns false if too early). |
best, but requires the caller to space frames sensibly |
Why this is separate from transport-hint
RenderingHint controls when show() returns to the caller.
TransportHint (separate issue) controls which DMA/CPU path the driver uses to actually deliver bytes to the peripheral.
The two are orthogonal: you can have Sync + IsrStream (rare — block on a streaming transmission) just as much as Async + OneShot (common — DMA-backed driver returns immediately after enqueueing).
Acceptance
-
fl::RenderingHintenum defined withAuto = 0,Sync = 1,Async = 2. -
Channel::setRenderingHint(...)+ getter; default-constructed channels reportAuto. - Each driver's
show()honors the hint:Auto: driver picks based on transport choice.Sync: block until transmission complete.Async: return after DMA enqueue.
- Drivers that can't honor Async (bitbang, CPU-polled) silently treat Async as Sync — document this behavior in the header.
- Drivers that can't honor Sync efficiently (some streaming peripherals) document the cost.
- Test in
tests/fl/channels/confirms: withAsyncset, a sketch can do non-LED work betweenshow()calls and the LED frames complete on the wire correctly. -
bash autoresearch <board>for at least one DMA-backed driver per platform exercises bothSyncandAsyncpaths.
Out of scope
- The transport-hint API (
one_shotvsisr_streamvscpu_poll) — separate issue filed alongside this one. - Multi-frame queueing — only one outstanding
Asyncframe at a time for now. Multi-frame queue is a future enhancement.
Cross-references
- Sibling: transport-hint issue (filed alongside).
- Parent meta family: [meta] Teensy 4 channels-API driver coverage + verification fixtures (supersedes #2764, #3006) #3023 (channels-API) + [meta] ISR-chunked streaming conversion for clockless / clocked drivers #3177 (ISR streaming).
- Reference for the async path: existing ESP32 PARLIO + I2S already-async implementations.
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
- StatusShow more project fieldsDone
Activity
zackees commentedon Jun 16, 2026
Closing — premature. Per user direction, the
syncvsasyncrendering decision should not be locked in right now. Re-file when the trade-offs around async ordering, frame queueing, and per-driver completion semantics are settled.