FastLED 3.10.10
Loading...
Searching...
No Matches
FastLED.cpp.hpp
Go to the documentation of this file.
1#define FASTLED_INTERNAL
2// IWYU pragma: begin_keep
3#include <stdint.h>
4// IWYU pragma: end_keep // for u8, u32, u16
5#if defined(NEED_CXX_BITS) && (defined(FL_IS_ESP32) || defined(FL_IS_ESP8266))
6#error FastLED #4994: NEED_CXX_BITS on ESP32/ESP8266 breaks thread-safe local statics with LTO
7#endif
8#include "FastLED.h" // ok include: this file implements CFastLED, declared in FastLED.h
12#include "fl/channels/channel.h"
16#include "fl/channels/manager.h"
19#include "fl/system/trace.h"
20#include "fl/channels/driver.h" // for IChannelDriver
21#include "fl/channels/detail/wait_spin_budget.h" // for tiered-wait spin-budget setters (#2818)
23#include "fl/system/delay.h" // for delayMicroseconds
24#include "fl/system/yield.h" // for fl::yield
26#if SKETCH_HAS_LARGE_MEMORY
27#include "fl/task/executor.h"
28#include "fl/net/network_detector.h" // adaptive yield gate in the refresh throttle (#3762)
29#endif
30#include "fl/log/log.h" // for FL_WARN
31#include "fl/stl/assert.h" // for FL_ASSERT
32#include "fl/audio/audio_manager.h" // for AudioManager
33#include "fl/ui/audio.h" // for UIAudio (CFastLED::add(UIAudio&))
34#include "hsv2rgb.h" // for CRGB
35#include "fl/stl/int.h" // for u32, u16
36#include "fl/stl/type_traits.h" // for conditional_t
37#include "platforms/init.h" // IWYU pragma: keep
38#include "fl/channels/config.h" // for ChannelConfig
39#include "fl/stl/singleton.h" // for fl::Singleton
40#include "platforms/is_platform.h"
41#include "fl/stl/noexcept.h"
42
45
46#ifndef MAX_CLED_CONTROLLERS
47#ifdef FL_IS_AVR
48// Uno/Nano-class (328P family) parts keep 8 slots to save RAM, as in 3.10.3;
49// larger ATmegas allow 16. Define MAX_CLED_CONTROLLERS to override (#4788).
50#if defined(FL_IS_AVR_ATMEGA) && !defined(FL_IS_AVR_ATMEGA_328P)
51#define MAX_CLED_CONTROLLERS 16
52#else
53#define MAX_CLED_CONTROLLERS 8
54#endif
55#else
56#define MAX_CLED_CONTROLLERS 64
57#endif // FL_IS_AVR
58#endif // MAX_CLED_CONTROLLERS
59
60#if defined(FL_IS_SAM)
61volatile fl::u32 fuckit;
62#endif
63
64
65#ifndef FASTLED_NO_ATEXIT
66#define FASTLED_NO_ATEXIT 0
67#endif
68
69#if !FASTLED_NO_ATEXIT
70extern "C" FL_LINK_WEAK int atexit(void (* /*func*/ )()) { return 0; }
71#endif
72
73#ifdef FASTLED_NEEDS_YIELD
74extern "C" void yield(void) { }
75#endif
76
77// Implementation of cled_contoller_size() moved to src/fl/fastled_internal.cpp
78
80
81#if !FL_PLATFORM_HAS_TINY_MEMORY
82// FL_LINT_ALLOW_GLOBAL(shared dither phase is required once per logical frame)
84
88#endif
89
92// FL_LINT_ALLOW_GLOBAL(extern ABI: smartmatrix_t3.h declares `extern SmartMatrix *pSmartMatrix`)
93void *pSmartMatrix = nullptr;
94
97
98CFastLED FastLED; // global constructor allowed in this case.
99
101
103static fl::u32 lastshow = 0;
104
105namespace fl {
108// FL_LINT_ALLOW_GLOBAL(mutable counter written by the driver via extern)
110
112// FL_LINT_ALLOW_GLOBAL(mutable counter written by the driver via extern)
114} // namespace fl
115
116// uint32_t CRGB::Squant = ((uint32_t)((__TIME__[4]-'0') * 28))<<16 | ((__TIME__[6]-'0')*50)<<8 | ((__TIME__[7]-'0')*28);
117
119 // clear out the array of led controllers
120 // m_nControllers = 0;
121 mScale = 255;
122 mNFPS = 0;
123 mPPowerFunc = nullptr;
124 mNPowerData = 0xFFFFFFFF;
126 mLastShownScale = 255;
127 mMaxRefreshHz = 0;
128}
129
130#if FL_COLOR_PIPELINE_SHARED
131const fl::FramePowerDispatch*& fl::activeFramePowerDispatch() FL_NO_EXCEPT {
132 static const FramePowerDispatch* dispatch = nullptr;
133 return dispatch;
134}
135#endif
136
138 // Call platform-specific initialization once
139 // Uses the trampoline pattern: platforms/init.h dispatches to platform-specific headers
140 // FL_RUN_ONCE ensures this is only called once, even if init() is called multiple times
141 FL_RUN_ONCE(fl::platforms::init());
142}
143
145 return (*this)[0].size();
146}
147
149 return (*this)[0].leds();
150}
151
153 CRGB *data,
154 int nLedsOrOffset, int nLedsIfOffset) FL_NO_EXCEPT {
155 int nOffset = (nLedsIfOffset > 0) ? nLedsOrOffset : 0;
156 int nLeds = (nLedsIfOffset > 0) ? nLedsIfOffset : nLedsOrOffset;
157
158 pLed->init();
159 pLed->setLeds(data + nOffset, nLeds);
160 FastLED.setMaxRefreshRate(pLed->getMaxRefreshRate(),true);
161 fl::EngineEvents::onStripAdded(pLed, nLedsOrOffset - nOffset);
162 return *pLed;
163}
164
168
169#if FL_COLOR_PIPELINE_SHARED
170fl::shared_ptr<fl::StreamingPipelineQ16> fl::channelColorPipeline(
172 const fl::Channel* channel = controller.asChannel();
173 return channel != nullptr ? channel->colorPipeline()
175}
176#endif
177
180 PowerCodecPolicy policy;
182 for (fl::size i = 0; i < registered.size(); ++i) {
183 const fl::Channel* channel = registered[i].get();
184 if (channel != &controller) continue;
185 policy.kind = PowerCodecKind::Byte;
187 channel->getChipset().ptr<fl::SpiChipsetConfig>();
188 if (spi == nullptr) return policy;
189 switch (spi->timing.chipset) {
192 break;
195 break;
201 const fl::EmitterProfile* profile = channel->emitterProfile();
203 spi->timing.chipset, profile != nullptr
204 ? profile->five_bit_semantics
207 semantics, fl::detail::hdFieldFloor());
208 break;
209 }
210 default:
211 break;
212 }
213 return policy;
214 }
215 // A custom managed controller has no known wire encoding. Charging full
216 // code for every lit emitter is conservative, never a silent guess.
217 return policy;
218}
219
220void CFastLED::add(fl::ChannelPtr channel) FL_NO_EXCEPT {
221 if (!channel) {
222 return;
223 }
224 auto& chnls = channels();
225 // Protect against double-add
226 if (chnls.has(channel)) {
227 return;
228 }
229 chnls.push_back(channel);
230 // Add channel to the CLEDController linked list
231 // fl::Channel uses DeferRegister mode, so explicit addToDrawList() call is required
232 // Note: addToDrawList() now fires onChannelAdded event
233 channel->addToDrawList();
234}
235
236void CFastLED::remove(fl::ChannelPtr channel) FL_NO_EXCEPT {
237 if (!channel) {
238 return;
239 }
240 // Note: removeFromDrawList() now fires onChannelRemoved event
241 channel->removeFromDrawList();
242 // Remove from internal storage (safe if not found - erase is a no-op)
243 channels().erase(channel);
244}
245
247 // Lambda to check if flag is set, clear it, and return true if it was set
248 auto clearFlag = [&flags](ClearFlags flag) -> bool {
249 if ((flags & flag) != ClearFlags::NONE) {
250 flags = static_cast<ClearFlags>(static_cast<fl::u32>(flags) & ~static_cast<fl::u32>(flag));
251 return true;
252 }
253 return false;
254 };
255
256
257 // Reset POWER_SETTINGS - reset power management to defaults
258 if (clearFlag(ClearFlags::POWER_SETTINGS)) {
259 FastLED.mPPowerFunc = nullptr; // No power limiting function
260 FastLED.mNPowerData = 0xFFFFFFFF; // No power limit (max value)
261 FastLED.mLastRequestedScale = 255;
262 FastLED.mLastShownScale = 255;
263 }
264
265 // Reset BRIGHTNESS - reset global brightness to 255 (full brightness)
266 if (clearFlag(ClearFlags::BRIGHTNESS)) {
267 FastLED.mScale = 255;
268 }
269
270 // Reset REFRESH_RATE - reset refresh rate limiting to unlimited
271 if (clearFlag(ClearFlags::REFRESH_RATE)) {
272 FastLED.mMaxRefreshHz = 0; // No minimum delay between frames
273 }
274
275 // Reset FPS_COUNTER - reset FPS tracking counter to 0
276 if (clearFlag(ClearFlags::FPS_COUNTER)) {
277 FastLED.mNFPS = 0;
278 }
279
280 // Reset CHANNELS - remove all channels from controller list
281 if (clearFlag(ClearFlags::CHANNELS)) {
282 // Wait for engines to complete, with 2s timeout to prevent infinite hang
283 // if an engine is permanently stalled (e.g. PARLIO on ESP32-C6 hw bug)
284 FastLED.wait(2000);
285
286 // Remove all channels by iterating through a copy of the vector
287 // (we make a copy because remove() modifies channels())
288 fl::vector<fl::ChannelPtr> channelsCopy = channels();
289 for (auto& channel : channelsCopy) {
290 remove(channel);
291 }
292
293 // Reset bus manager state (clear enqueued and transmitting channels)
295 manager.reset();
296
297 // Clear the internal storage (should already be empty, but ensure it)
298 channels().clear();
299 }
300
301 // Reset CHANNEL_ENGINES - clear all registered channel drivers
302 if (clearFlag(ClearFlags::CHANNEL_ENGINES)) {
303 // Always wait for all channel bus transmissions to complete first
304 FastLED.wait();
306 manager.clearAllDrivers();
307 }
308
309 // Ensure all flags were handled - catches typos or missing implementations
310 FL_ASSERT(flags == ClearFlags::NONE, "Unhandled flags in FastLED.clear()");
311}
312
313// This is bad code. But it produces the smallest binaries for reasons
314// beyond mortal comprehensions.
315// Instead of iterating through the link list for onBeginFrame(), beginShowLeds()
316// and endShowLeds(): store the pointers in an array and iterate through that.
317//
318// static uninitialized gControllersData produces the smallest binary on attiny85.
319// FL_LINT_ALLOW_GLOBAL(intentional ATtiny85 code-size optimization — moving to Singleton<T> reverses the size win documented above)
321
322// Refresh-rate throttle shared by show() and showColor().
323//
324// This mirrors the tiered wait already shipped in
325// IChannelDriver::waitForCondition (refs #2818 for the spin tier, #2815/#2817
326// for the adaptive yield). show() was the last call site still taking an
327// UNCONDITIONAL deep yield, which is the root cause of FastLED#2994.
328//
329// Why it matters: fl::task::run(<non-zero>, SYSTEM) routes to
330// pumpCoroutines(), which on ESP32 floors at one FreeRTOS tick
331// (coroutine_esp32.impl.hpp, the `if (ticks == 0) ticks = 1` branch added for
332// the #2254 websocket-starvation fix). That is >=1 ms at
333// CONFIG_FREERTOS_HZ=1000 and >=10 ms at the 100 Hz default. With
334// setMaxRefreshRate(800) the throttle only needs 1250 us, so every frame
335// overshot to a tick boundary -- ~500 shows per sequence x sub-ms jitter is
336// the 63-300 ms drift reported in #2994, against a rock-steady 2495 ms on
337// 3.10.3 (which used a plain busy-wait).
338//
339// Two tiers:
340// - No radio up: taskYIELD() only. Equal-priority tasks still run, and there
341// is no tick floor, so the wait stays microsecond-accurate.
342// - Radio up: keep the deep yield -- WiFi/lwIP/BT genuinely need the CPU --
343// but stop taking it once less than the spin budget remains, so the final
344// stretch is spun out instead of overshooting past our deadline.
345static void throttleToMaxRefreshRate(fl::u32 minMicros) FL_NO_EXCEPT {
346 if (!minMicros) {
347 return;
348 }
349#if SKETCH_HAS_LARGE_MEMORY
350 const fl::u32 spinBudget = fl::detail::getWaitSpinBudgetUs();
351#endif
352 while (true) {
353 const fl::u32 elapsed = fl::micros() - lastshow;
354 if (elapsed >= minMicros) {
355 return;
356 }
357#if SKETCH_HAS_LARGE_MEMORY
358 const fl::u32 remaining = minMicros - elapsed;
359 // Deep yield only while a radio is up AND there is more than the spin
360 // budget left to burn. Once inside the budget we spin, because a deep
361 // yield costs a whole tick and would overshoot the deadline.
362 if (remaining > spinBudget && fl::NetworkDetector::isAnyNetworkActive()) {
364 } else {
365 // taskYIELD()-equivalent: equal-priority tasks still get CPU, but
366 // there is no FreeRTOS tick floor, so this stays sub-microsecond.
368 }
369#endif
370 }
371}
372
376
380
383 onBeginFrame();
386
388 // If we have a function for computing power, use it!
389 if(mPPowerFunc) {
390 scale = (*mPPowerFunc)(scale, mNPowerData);
391 }
393
394
395 // A byte index saves bookkeeping on 16-bit-int targets; retain wider limits.
396 using ControllerIndex = fl::conditional_t<
398 ControllerIndex length = 0;
400
401 while(pCur && length < MAX_CLED_CONTROLLERS) {
402 if (pCur->getEnabled()) {
403 gControllersData[length] = pCur->beginShowLeds(pCur->size());
404 } else {
405 gControllersData[length] = nullptr;
406 }
407 length++;
409 pCur = pCur->next();
410 }
411
412 pCur = CLEDController::head();
413 for (length = 0; length < MAX_CLED_CONTROLLERS && pCur; length++) {
414 if (pCur->getEnabled()) {
415 pCur->showLedsInternal(scale);
416 }
417 pCur = pCur->next();
418
419 }
420
421 length = 0; // Reset length to 0 and iterate again.
422 pCur = CLEDController::head();
423 while(pCur && length < MAX_CLED_CONTROLLERS) {
424 if (pCur->getEnabled()) {
426 }
427 length++;
428 pCur = pCur->next();
429 }
430 countFPS();
431 onEndFrame();
433}
434
438
440 int x = 0;
442 while( pCur) {
443 ++x;
444 pCur = pCur->next();
445 }
446 return x;
447}
448
451 while(x-- && pCur) {
452 pCur = pCur->next();
453 }
454 if(pCur == nullptr) {
455 return *(CLEDController::head());
456 } else {
457 return *pCur;
458 }
459}
460
462 onBeginFrame();
465
467 // If we have a function for computing power, use it!
468 if(mPPowerFunc) {
469 // showColor() encodes a constant, not controller source pixels; the
470 // source-frame managed prepass cannot model it.
471#if FL_COLOR_PIPELINE_SHARED
472 const fl::FramePowerDispatch* dispatch = fl::activeFramePowerDispatch();
473 scale = dispatch ? dispatch->showColorBrightness(scale, mNPowerData)
474 : (*mPPowerFunc)(scale, mNPowerData);
475#else
476 scale = (*mPPowerFunc)(scale, mNPowerData);
477#endif
478 }
480
481 int length = 0;
483 while(pCur && length < MAX_CLED_CONTROLLERS) {
484 if (pCur->getEnabled()) {
485 gControllersData[length] = pCur->beginShowLeds(pCur->size());
486 } else {
487 gControllersData[length] = nullptr;
488 }
489 length++;
490 pCur = pCur->next();
491 }
492
493 pCur = CLEDController::head();
494 while(pCur && length < MAX_CLED_CONTROLLERS) {
496 if (pCur->getEnabled()) {
497 pCur->showColorInternal(color, scale);
498 }
499 pCur = pCur->next();
500 }
501
502 pCur = CLEDController::head();
503 length = 0; // Reset length to 0 and iterate again.
504 while(pCur && length < MAX_CLED_CONTROLLERS) {
505 if (pCur->getEnabled()) {
507 }
508 length++;
509 pCur = pCur->next();
510 }
511 countFPS();
512 onEndFrame();
514}
515
516void CFastLED::clear(bool writeData) FL_NO_EXCEPT {
517 if(writeData) {
518 showColor(CRGB(0,0,0), 0);
519 }
520 clearData();
521}
522
525 while(pCur) {
526 pCur->clearLedDataInternal();
527 pCur = pCur->next();
528 }
529}
530
531void CFastLED::delay(unsigned long ms) FL_NO_EXCEPT {
532 unsigned long start = fl::millis();
533 do {
534#ifndef FASTLED_ACCURATE_CLOCK
535 // make sure to allow at least one ms to pass to ensure the clock moves
536 // forward
537 fl::delay(1);
538#endif
539 show();
540 fl::yield();
541 }
542 while((fl::millis()-start) < ms);
543}
544
547 while(pCur) {
548 pCur->setTemperature(temp);
549 pCur = pCur->next();
550 }
551}
552
553void CFastLED::setCorrection(const CRGB & correction) FL_NO_EXCEPT {
555 while(pCur) {
556 pCur->setCorrection(correction);
557 pCur = pCur->next();
558 }
559}
560
563 while(pCur) {
564 pCur->setDither(ditherMode);
565 pCur = pCur->next();
566 }
567}
568
571 min_field < 1 ? 1 : (min_field > 31 ? 31 : min_field);
572}
573
577
578fl::u32 CFastLED::getEstimatedPowerInMilliWatts(bool apply_limiter) const FL_NO_EXCEPT {
579#if FL_COLOR_PIPELINE_SHARED
580 if (apply_limiter && mPPowerFunc && fl::activeFramePowerDispatch()) {
581 bool managed = false;
582 for (CLEDController* p = CLEDController::head(); p; p = p->next()) {
583 if (p->getEnabled() && fl::channelColorPipeline(*p)) {
584 managed = true;
585 break;
586 }
587 }
588 if (managed) {
589 const fl::FramePowerPlan plan =
590 fl::activeFramePowerDispatch()->calculate(mScale, mNPowerData);
591 if (plan.modeled_mW == 0xFFFFFFFFu) return plan.modeled_mW;
592 const fl::u32 mcu_mW = plan.mcu_mW;
593 return plan.modeled_mW > mcu_mW ? plan.modeled_mW - mcu_mW : 0;
594 }
595 }
596#endif
597 fl::u32 fixed_power_mW = 0;
598 fl::u32 controllable_power_mW = 0;
599 fl::u32 dither_reserve_power_mW = 0;
600
601 // Sum unscaled power from all LED controllers using visitor pattern.
602 // The dark-current baseline is kept apart from the part brightness scales,
603 // because it is drawn at every brightness including zero (#4156 R4).
604 const fl::u32 dark_mW_per_led = get_power_model().dark_mW;
606 if (!leds.empty()) {
607 // The controller's own estimate: its RGBW setting, so an RGBW strip
608 // is charged for the diode it actually lights, and for a bound
609 // colour profile the solved drives rather than the source (#4344).
610 const fl::u32 unscaled_mW = controller_unscaled_power_mW(*controller);
611 const fl::u32 dark_mW = dark_mW_per_led * static_cast<fl::u32>(leds.size());
612 fixed_power_mW += dark_mW;
613 controllable_power_mW += unscaled_mW > dark_mW ? unscaled_mW - dark_mW : 0;
614 // What dithering can add on top, at any non-zero brightness (#4342).
615 // Not on TINY, where the bound costs more flash than the tier has
616 // to spare (#4478); controller_dither_reserve_mW is 0 there.
617#if !FL_PLATFORM_HAS_TINY_MEMORY
618 dither_reserve_power_mW += controller_dither_reserve_mW(*controller);
619#endif
620 }
621 });
622
623 // Determine effective brightness
624 fl::u8 effective_brightness = mScale;
625
626 if (apply_limiter && mPPowerFunc) {
627 // Power limiting is enabled and user wants limited power - calculate brightness after limiting
628 // This calls calculate_max_brightness_for_power_mW(mScale, mNPowerData)
629 effective_brightness = (*mPPowerFunc)(mScale, mNPowerData);
630 }
631
632 // Scale only the emitter share by the configured power-brightness response
633 // and add the baseline back, so the estimate matches what the limiter now
634 // budgets against.
635 // Note: MCU power consumption is NOT included - caller should add platform-specific MCU power if needed
636 // The dither reserve only at a non-zero brightness: nothing dithers at 0,
637 // the same as the limiter, whose answer of 0 needs no reserve either.
638 if (effective_brightness != 0) {
639 fixed_power_mW += dither_reserve_power_mW;
640 }
641 return fixed_power_mW +
642 scale_power_for_brightness(controllable_power_mW, effective_brightness);
643}
644
645//
646// template<int m, int n> void transpose8(unsigned char A[8], unsigned char B[8]) {
647// uint32_t x, y, t;
648//
649// // Load the array and pack it into x and y.
650// y = *(unsigned int*)(A);
651// x = *(unsigned int*)(A+4);
652//
653// // x = (A[0]<<24) | (A[m]<<16) | (A[2*m]<<8) | A[3*m];
654// // y = (A[4*m]<<24) | (A[5*m]<<16) | (A[6*m]<<8) | A[7*m];
655//
656 // // pre-transform x
657 // t = (x ^ (x >> 7)) & 0x00AA00AA; x = x ^ t ^ (t << 7);
658 // t = (x ^ (x >>14)) & 0x0000CCCC; x = x ^ t ^ (t <<14);
659 //
660 // // pre-transform y
661 // t = (y ^ (y >> 7)) & 0x00AA00AA; y = y ^ t ^ (t << 7);
662 // t = (y ^ (y >>14)) & 0x0000CCCC; y = y ^ t ^ (t <<14);
663 //
664 // // final transform
665 // t = (x & 0xF0F0F0F0) | ((y >> 4) & 0x0F0F0F0F);
666 // y = ((x << 4) & 0xF0F0F0F0) | (y & 0x0F0F0F0F);
667 // x = t;
668//
669// B[7*n] = y; y >>= 8;
670// B[6*n] = y; y >>= 8;
671// B[5*n] = y; y >>= 8;
672// B[4*n] = y;
673//
674// B[3*n] = x; x >>= 8;
675// B[2*n] = x; x >>= 8;
676// B[n] = x; x >>= 8;
677// B[0] = x;
678// // B[0]=x>>24; B[n]=x>>16; B[2*n]=x>>8; B[3*n]=x>>0;
679// // B[4*n]=y>>24; B[5*n]=y>>16; B[6*n]=y>>8; B[7*n]=y>>0;
680// }
681//
682// void transposeLines(Lines & out, Lines & in) {
683// transpose8<1,2>(in.bytes, out.bytes);
684// transpose8<1,2>(in.bytes + 8, out.bytes + 1);
685// }
686
687
690extern int noise_min;
691
694extern int noise_max;
695
697 static int br = 0;
698#if SKETCH_HAS_LARGE_MEMORY
699 typedef fl::u32 frame_ms_t;
700#else
701 // Wrapping 16-bit millis saves 2 B RAM; nFrames frames must take < 65 s (#4788).
702 typedef fl::u16 frame_ms_t;
703#endif
704 static frame_ms_t lastframe = 0; // fl::millis();
705
706 if(br++ >= nFrames) {
707 const frame_ms_t sample = static_cast<frame_ms_t>(fl::millis());
708 frame_ms_t now = static_cast<frame_ms_t>(sample - lastframe);
709 if(now == 0) {
710 now = 1; // prevent division by zero below
711 }
712 mNFPS = static_cast<fl::u16>((static_cast<fl::u32>(br) * 1000) / now);
713 br = 0;
714 lastframe = sample;
715 }
716}
717
718void CFastLED::setMaxRefreshRate(fl::u16 refresh, bool constrain) FL_NO_EXCEPT {
719 if(constrain) {
720 // When constraining we may only slow things down: keep the lower cap.
721 if(refresh > 0 && (mMaxRefreshHz == 0 || refresh < mMaxRefreshHz)) {
722 mMaxRefreshHz = refresh;
723 }
724 } else {
725 mMaxRefreshHz = refresh; // 0 = unlimited
726 }
727}
728
729
731 return FastLED.getBrightness();
732}
733
734// ============================================================================
735// Deprecated Power Management Wrapper Functions
736// ============================================================================
737// These functions wrap the CFastLED singleton methods for backward compatibility.
738// They were originally in power_mgt.cpp but have been moved here to avoid
739// circular dependencies (power_mgt.cpp should not include FastLED.h).
740
741void set_max_power_in_volts_and_milliamps(fl::u8 volts, fl::u32 milliamps)
743 FastLED.setMaxPowerInVoltsAndMilliamps(volts, milliamps);
744}
745
746void set_max_power_in_milliwatts(fl::u32 powerInmW)
748 FastLED.setMaxPowerInMilliWatts(powerInmW);
749}
750
753 // power management usage is now in FastLED.show, no need for this function
754 FastLED.show();
755}
756
759 FastLED.delay(ms);
760}
761
762// ============================================================================
763// Channel Bus Manager Controls
764// ============================================================================
765
769
770void CFastLED::setDriverEnabled(const char* name, bool enabled) FL_NO_EXCEPT {
772 manager.setDriverEnabled(name, enabled);
773}
774
777 return manager.setExclusiveDriver(bus, which);
778}
779
780bool CFastLED::isDriverEnabled(const char* name) const FL_NO_EXCEPT {
782 return manager.isDriverEnabled(name);
783}
784
787 return manager.getDriverCount();
788}
789
794
795// ============================================================================
796// Wait for channel bus transmissions
797// ============================================================================
798
800 // A zero timeout means wait indefinitely. The void API cannot report a
801 // timeout, so returning early would violate its completion contract.
802 // Dispatch only to consumers already in use; do not construct a manager
803 // in legacy-only sketches just to wait for their direct driver.
805}
806
807bool CFastLED::wait(fl::u32 timeout_ms) FL_NO_EXCEPT {
808 return fl::detail::waitForDriverCompletion(timeout_ms);
809}
810
811// Tiered-wait spin-budget shims (#2818). Storage in
812// src/fl/channels/detail/wait_spin_budget.cpp.hpp.
816
820
821// ============================================================================
822// Runtime Channel API Implementation
823// ============================================================================
824
825fl::ChannelPtr CFastLED::add(const fl::ChannelConfig& config) FL_NO_EXCEPT {
826 // Runtime-selection mode links no driver by itself. Drivers come from
827 // FastLED.enable<fl::Bus::X>() bindings (constructed here, on first use),
828 // from FastLED.enableAllDrivers() (the catch-all), or from anything else
829 // that registered one. A channel no driver can serve gets a warning, not
830 // every driver on the platform.
831 const fl::Bus bus = config.options.mBus;
832 const fl::u8 which = config.options.mBusWhich;
834
836 const bool spi = config.getChipset().is<fl::SpiChipsetConfig>();
837 bool served = false;
838 if (bus != fl::Bus::AUTO) {
840 fl::busDriverName(bus, which, spi))) != nullptr;
841 } else {
842 // AUTO needs a registered driver for this chipset family, not just
843 // any driver: an SPI-only binding cannot serve a clockless channel.
844 for (const fl::DriverInfo& info : manager.getDriverInfos()) {
845 auto driver = manager.findDriverByName(info.name);
846 if (driver && (spi ? driver->getCapabilities().supportsSpi
847 : driver->getCapabilities().supportsClockless)) {
848 served = true;
849 break;
850 }
851 }
852 }
853 if (!served && bus == fl::Bus::AUTO && fl::DriverBindings::instance().empty()) {
854 // Legacy (3.10.9) compatibility: the sketch never opted into any
855 // driver, so bind the platform default driver for this chipset
856 // family, as 3.10.9's add(cfg) did. Only the default clockless and
857 // default SPI drivers are referenced here (not every driver), so
858 // explicit enable<Bus>() sketches keep most of the link-time saving.
859 // Platforms without a DefaultBus specialization bind nothing here.
860 const bool bound = spi
863 if (bound) {
864 for (const fl::DriverInfo& info : manager.getDriverInfos()) {
865 auto driver = manager.findDriverByName(info.name);
866 if (driver && (spi ? driver->getCapabilities().supportsSpi
867 : driver->getCapabilities().supportsClockless)) {
868 served = true;
869 break;
870 }
871 }
872 }
873 }
874 if (!served) {
875 FL_WARN_EVERY(1000, "FastLED.add(cfg): no channel driver is enabled for bus '"
876 << fl::busName(bus) << "'. Call FastLED.enable<fl::Bus::"
877 << fl::busName(bus) << ">() before add() to link only that "
878 "driver, or FastLED.enableAllDrivers() to link every driver.");
879 }
880 auto channel = fl::Channel::create(config);
881 add(channel);
882 return channel;
883}
884
887 channels.reserve(configs.size());
888
889 for (const auto& config : configs) {
890 channels.push_back(add(config));
891 }
892
893 return channels;
894}
895
896fl::vector<fl::ChannelPtr> CFastLED::add(fl::initializer_list<fl::ChannelConfig> configs) FL_NO_EXCEPT {
898 channels.reserve(configs.size());
899
900 for (const auto& config : configs) {
901 channels.push_back(add(config));
902 }
903
904 return channels;
905}
906
909 channels.reserve(multiConfig.mChannels.size());
910
911 for (const auto& configPtr : multiConfig.mChannels) {
912 if (configPtr) {
913 channels.push_back(add(*configPtr));
914 }
915 }
916
917 return channels;
918}
919
920fl::RxChannelPtr CFastLED::addRx(const fl::RxChannelConfig& config) FL_NO_EXCEPT {
921 return fl::RxChannel::create(config);
922}
923
924// ============================================================================
925
926#ifdef NEED_CXX_BITS
927#if defined(FL_IS_ESP32) || defined(FL_IS_ESP8266)
928#error FastLED #4994: NEED_CXX_BITS on ESP32/ESP8266 breaks thread-safe local statics with LTO
929#endif
930namespace __cxxabiv1
931{
932 #if !defined(FL_IS_ESP8266) && !defined(FL_IS_ESP32) && !defined(ARDUINO)
933 extern "C" void __cxa_pure_virtual (void) {}
934 #endif
935
936 /* guard variables */
937
938 /* The ABI requires a 64-bit type. */
939 __extension__ typedef int __guard __attribute__((mode(__DI__)));
940
941 extern "C" int __cxa_guard_acquire (__guard *) FL_LINK_WEAK;
942 extern "C" void __cxa_guard_release (__guard *) FL_LINK_WEAK;
943 extern "C" void __cxa_guard_abort (__guard *) FL_LINK_WEAK;
944
945 extern "C" int __cxa_guard_acquire (__guard *g)
946 {
947 return !*(char *)(g);
948 }
949
950 extern "C" void __cxa_guard_release (__guard *g)
951 {
952 *(char *)g = 1;
953 }
954
955 extern "C" void __cxa_guard_abort (__guard *)
956 {
957
958 }
959}
960#endif
961
962
966
967
969 #if FASTLED_HAS_ENGINE_EVENTS
971 #endif
972}
973
977
981
982// ============================================================================
983// CFastLED audio method implementations - thin trampolines to AudioManager
984// ============================================================================
985
990
995
1000
int x
Definition simple.h:92
FastLED show()
#define MAX_CLED_CONTROLLERS
FL_LINK_WEAK int atexit(void(*)())
void * pSmartMatrix
Pointer to the matrix object when using the Smart Matrix Library.
fl::u8 get_brightness() FL_NO_EXCEPT
static fl::u32 lastshow
static void * gControllersData[MAX_CLED_CONTROLLERS]
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
int noise_max
Unused value.
static void throttleToMaxRefreshRate(fl::u32 minMicros) FL_NO_EXCEPT
int noise_min
Unused value.
ClearFlags
Flags for FastLED.clear() to control what state gets cleared/reset.
Definition FastLED.h:663
@ CHANNELS
Remove all channels from controller list.
Definition FastLED.h:665
@ BRIGHTNESS
Reset global brightness to 255.
Definition FastLED.h:667
@ CHANNEL_ENGINES
Clear all channel drivers from ChannelManager.
Definition FastLED.h:670
@ POWER_SETTINGS
Reset power management (setMaxPowerInMilliWatts)
Definition FastLED.h:666
@ FPS_COUNTER
Reset FPS tracking counter to 0.
Definition FastLED.h:669
@ NONE
Clear nothing (no-op)
Definition FastLED.h:664
@ REFRESH_RATE
Reset refresh rate limiting to unlimited.
Definition FastLED.h:668
#define FL_DITHER_ENABLE_MIN_REFRESH_HZ
High level controller interface for FastLED.
Definition FastLED.h:714
CFastLED FastLED
Global LED strip management instance.
central include file for FastLED, defines the CFastLED class/object
CLEDController * controller
fl::UISlider scale("Scale", 4,.1, 4,.1)
Declaration of fl::enableAllDrivers() — enrolls every channel driver available on the current platfor...
#define FL_ASSERT(x, MSG)
Definition assert.h:6
ESP32-P4 Parallel IO (PARLIO) LED channel.
void clear(bool writeData=false) FL_NO_EXCEPT
Clear the leds, wiping the local array of data.
power_func mPPowerFunc
function for overriding brightness when using FastLED.show();
Definition FastLED.h:728
fl::u8 getHdFieldFloor() const FL_NO_EXCEPT
void setExclusiveDriver() FL_NO_EXCEPT
Register a single driver at a priority above the platform default (compile-time TU-linking variant).
Definition FastLED.h:1693
void setCorrection(const CRGB &correction) FL_NO_EXCEPT
Set a global color correction.
static void _setWaitSpinBudgetUs(fl::u32 budget_us) FL_NO_EXCEPT
static void add(fl::ChannelPtr channel) FL_NO_EXCEPT
Add a Channel-based LED controller (from ChannelPtr)
void show() FL_NO_EXCEPT
Update all our controllers with the current led colors.
Definition FastLED.h:1965
void setDriverEnabled(const char *name, bool enabled) FL_NO_EXCEPT
Enable or disable a channel driver by name at runtime.
CFastLED() FL_NO_EXCEPT
static fl::ChannelEvents & channelEvents() FL_NO_EXCEPT
Access the channel event system.
void countFPS(int nFrames=25) FL_NO_EXCEPT
For debugging, this will keep track of time between calls to countFPS().
void onEndShowLeds() FL_NO_EXCEPT
Manually trigger the end show LEDs event.
static fl::u32 _getWaitSpinBudgetUs() FL_NO_EXCEPT
static fl::Watchdog & watchdog() FL_NO_EXCEPT
Access the unified cross-platform watchdog timer.
static void remove(fl::ChannelPtr channel) FL_NO_EXCEPT
Remove a channel from the LED controller list.
int size() FL_NO_EXCEPT
Get the number of leds in the first controller.
void clearData() FL_NO_EXCEPT
Clear out the local data array.
void setDither(fl::u8 ditherMode=BINARY_DITHER) FL_NO_EXCEPT
Set the dithering mode.
fl::u8 getLastShowBrightness() const FL_NO_EXCEPT
Brightness the most recent show() / showColor() actually applied, after the power limiter set by setM...
static fl::vector< fl::ChannelPtr > & channels() FL_NO_EXCEPT
stored ChannelPtrs to keep them alive
void onBeginFrame() FL_NO_EXCEPT
Manually trigger the begin frame event.
void showColor(const CRGB &color, fl::u8 scale) FL_NO_EXCEPT
Set all leds on all controllers to the given color/scale.
void wait() FL_NO_EXCEPT
Wait for all channel bus transmissions to complete.
fl::u8 mScale
the current global brightness scale setting
Definition FastLED.h:724
void onEndFrame() FL_NO_EXCEPT
bool isPowerLimited() const FL_NO_EXCEPT
True if the power limiter lowered the brightness of the most recent show() / showColor() below what i...
CRGB * leds() FL_NO_EXCEPT
Get a pointer to led data for the first controller.
void delay(unsigned long ms) FL_NO_EXCEPT
Delay for the given number of milliseconds.
static fl::RxChannelPtr addRx(const fl::RxChannelConfig &config) FL_NO_EXCEPT
Add an RX channel with runtime configuration.
fl::u32 mNPowerData
max power use parameter
Definition FastLED.h:727
fl::u16 mNFPS
tracking for current frames per second (FPS) value
Definition FastLED.h:725
void setMaxRefreshRate(fl::u16 refresh, bool constrain=false) FL_NO_EXCEPT
Set the maximum refresh rate.
void init() FL_NO_EXCEPT
Initialize platform-specific subsystems.
fl::u8 mLastShownScale
brightness the last show()/showColor() applied, after the power limiter
Definition FastLED.h:730
void setTemperature(const CRGB &temp) FL_NO_EXCEPT
Set a global color temperature.
int count() FL_NO_EXCEPT
Get how many controllers have been registered.
fl::u8 mLastRequestedScale
brightness the last show()/showColor() was asked for
Definition FastLED.h:729
CLEDController & operator[](int x) FL_NO_EXCEPT
Get a reference to a registered controller.
::CLEDController & addLeds(::CLEDController *pLed, CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0) FL_NO_EXCEPT
Add a CLEDController instance to the world.
fl::span< const fl::DriverInfo > getDriverInfos() const FL_NO_EXCEPT
Get full state of all registered channel drivers.
bool isDriverEnabled(const char *name) const FL_NO_EXCEPT
Check if a driver is enabled by name.
fl::u32 getEstimatedPowerInMilliWatts(bool apply_limiter=true) const FL_NO_EXCEPT
Get estimated power consumption in milliwatts.
void setHdFieldFloor(fl::u8 min_field) FL_NO_EXCEPT
Lowest 5-bit current field the colour-managed APA102-HD path may use (B1's flicker floor,...
fl::size getDriverCount() const FL_NO_EXCEPT
Get count of registered channel drivers.
static void enableAllDrivers() FL_NO_EXCEPT
Enroll every channel driver available on this platform with ChannelManager.
fl::u16 mMaxRefreshHz
frame-rate cap in Hz, 0 = unlimited (u16 saves 2 B over micros, #4788)
Definition FastLED.h:726
and refresh rates, and provides access functions for driving led data to controllers via the show() /...
Definition FastLED.h:720
void showColorInternal(const CRGB &data, int nLeds, fl::u8 brightness) FL_NO_EXCEPT
void showLedsInternal(fl::u8 brightness) FL_NO_EXCEPT
Write the data to the LEDs managed by this controller.
static void visitControllers(Visitor &&visitor) FL_NO_EXCEPT
Visit all controllers in the linked list with a visitor The visitor must be a callable that accepts (...
CLEDController & setTemperature(CRGB temperature) FL_NO_EXCEPT
Set the color temperature, aka white point, for this controller.
void clearLedDataInternal(int nLeds=-1) FL_NO_EXCEPT
Zero out the LED data managed by this controller.
static CLEDController * head() FL_NO_EXCEPT
Get the first LED controller in the linked list of controllers.
bool getEnabled() FL_NO_EXCEPT
VIRTUAL_IF_NOT_AVR void * beginShowLeds(int size) FL_NO_EXCEPT
VIRTUAL_IF_NOT_AVR int size() const FL_NO_EXCEPT
How many LEDs does this controller manage?
VIRTUAL_IF_NOT_AVR void endShowLeds(void *data) FL_NO_EXCEPT
CLEDController & setDither(fl::u8 ditherMode=BINARY_DITHER) FL_NO_EXCEPT
Set the dithering mode for this controller to use.
static CLEDController * mPHead
pointer to the first LED controller in the linked list
CLEDController * next() FL_NO_EXCEPT
Get the next controller in the linked list after this one.
CLEDController & setCorrection(CRGB correction) FL_NO_EXCEPT
The color corrction to use for this controller, expressed as a CRGB object.
void removeFromDrawList() FL_NO_EXCEPT
Remove this channel from the global controller draw list.
const EmitterProfile * emitterProfile() const FL_NO_EXCEPT
Definition channel.h:235
void addToDrawList() FL_NO_EXCEPT
Add this channel to the global controller draw list.
const ChipsetVariant & getChipset() const FL_NO_EXCEPT
Get the chipset configuration variant.
Definition channel.h:136
LED channel for parallel output, pretty much a CPixelLEDController but with timing and pin informatio...
Definition channel.h:60
void setDriverEnabled(const char *name, bool enabled) FL_NO_EXCEPT
Enable or disable a driver by name at runtime.
void reset() FL_NO_EXCEPT
Reset bus manager state, clearing all enqueued and transmitting channels.
static ChannelManager & registry() FL_NO_EXCEPT
Get the singleton WITHOUT registering platform default drivers.
fl::shared_ptr< IChannelDriver > findDriverByName(const fl::string &name) const FL_NO_EXCEPT
Silent counterpart to getDriverByName().
fl::size getDriverCount() const FL_NO_EXCEPT
Get count of registered drivers (including unnamed ones)
void clearAllDrivers() FL_NO_EXCEPT
Remove all drivers from the manager.
void setExclusiveDriver() FL_NO_EXCEPT
Register a single driver at a priority above the platform default and disable all others (compile-tim...
Definition manager.h:365
bool isDriverEnabled(const char *name) const FL_NO_EXCEPT
Check if a driver is enabled by name.
fl::span< const DriverInfo > getDriverInfos() const FL_NO_EXCEPT
Get full state of all registered drivers.
Unified channel manager with priority-based driver selection.
Definition manager.h:51
bool bind(Bus bus, u8 which) FL_NO_EXCEPT
Bind (register) every node matching bus/which, or every node when bus is Bus::AUTO.
static DriverBindings & instance() FL_NO_EXCEPT
static void onBeginFrame() FL_NO_EXCEPT
static void onStripAdded(CLEDController *strip, fl::u32 num_leds) FL_NO_EXCEPT
static void onEndShowLeds() FL_NO_EXCEPT
static void onEndFrame() FL_NO_EXCEPT
static RxChannelPtr create(const RxChannelConfig &config) FL_NO_EXCEPT
static Watchdog & instance() FL_NO_EXCEPT
Unified cross-platform watchdog interface.
Definition watchdog.h:123
void remove(shared_ptr< Processor > processor) FL_NO_EXCEPT
static AudioManager & instance() FL_NO_EXCEPT
shared_ptr< Processor > add(const Config &config) FL_NO_EXCEPT
static bool isAnyNetworkActive() FL_NO_EXCEPT
static string from_literal(const char *literal) FL_NO_EXCEPT
fl::size size() const FL_NO_EXCEPT
fl::CLEDController CLEDController
Delay utilities for FastLED Includes nanosecond-precision delays, cycle counting, and microsecond del...
fl::UISlider length("Length", 1.0f, 0.0f, 1.0f, 0.01f)
Opt-in, link-on-use channel driver bindings for FastLED.add(cfg).
Task executor — runs registered task runners and manages the run loop.
fl::CRGB CRGB
Definition crgb.h:25
fl::u32 scale_power_for_brightness(fl::u32 total_mW, fl::u8 brightness) FL_NO_EXCEPT
Applies the configured power-scaling response to a total power value.
void delay_at_max_brightness_for_power(fl::u16 ms) FL_NO_EXCEPT
Similar to CFastLED::delay(), but pre-adjusts brightness to keep below the power threshold.
void set_max_power_in_milliwatts(fl::u32 powerInmW) FL_NO_EXCEPT
Set the maximum power used in watts.
fl::u32 controller_dither_reserve_mW(const fl::CLEDController &controller) FL_NO_EXCEPT
dither_reserve_mW() for a controller that dithers, and zero for one that does not: a mode other than ...
fl::u32 controller_unscaled_power_mW(const fl::CLEDController &controller) FL_NO_EXCEPT
One controller's demand at full brightness, in mW, including idle draw – the quantity the limiter sum...
void set_max_power_in_volts_and_milliamps(fl::u8 volts, fl::u32 milliamps) FL_NO_EXCEPT
Set the maximum power used in milliamps for a given voltage.
void show_at_max_brightness_for_power() FL_NO_EXCEPT
Similar to CFastLED::show(), but pre-adjusts brightness to keep below the power threshold.
PowerModelRGB get_power_model() FL_NO_EXCEPT
Get current RGB power model.
Functions to convert from the HSV colorspace to the RGB colorspace.
#define FL_WARN_EVERY(MILLIS,...)
Definition log.h:442
Centralized logging categories for FastLED hardware interfaces and subsystems.
Unified manager for channel drivers with priority-based fallback.
constexpr remove_reference< T >::type && move(T &&t) FL_NO_EXCEPT
Definition move.h:30
u8 & hdFieldFloor() FL_NO_EXCEPT
Backing store for CFastLED::setHdFieldFloor().
void setWaitSpinBudgetUs(fl::u32 budget_us) FL_NO_EXCEPT
Set the tiered-wait spin budget (microseconds).
fl::u32 getWaitSpinBudgetUs() FL_NO_EXCEPT
Get the current tiered-wait spin budget (microseconds).
u8 ditherFrame() FL_NO_EXCEPT
Return the temporal-dither phase shared by all controllers in this frame.
bool waitForDriverCompletion(u32 timeoutMs) FL_NO_EXCEPT
Wait for installed consumers using one deadline (zero means indefinitely).
bool bindDefaultDriver() FL_NO_EXCEPT
Bind the platform default driver for Chipset, if one exists.
unsigned char u8
Definition s16x16x4.h:132
void yield_system(fl::u32 microseconds) FL_NO_EXCEPT
OS-level yield only: same behavior as run(us, ExecFlags::SYSTEM).
unsigned char u8
Definition stdint.h:132
void enableAllDrivers() FL_NO_EXCEPT
Register every channel driver available on this platform with ChannelManager, restoring 3....
u8 u8 fract8 blur_amount FL_NO_EXCEPT
Definition blur.h:186
typename conditional< B, T, F >::type conditional_t
void delay(u32 ms, bool run_async=true) FL_NO_EXCEPT
Public delay wrapper that keeps bare Arduino delay() preferred after using fl::delay; while still all...
Definition delay.h:98
ChannelManager & channelManager() FL_NO_EXCEPT
Get the global ChannelManager singleton instance.
u32 _retry_cnt
Frame retry counter for ESP8266 clockless drivers (FASTLED_DEBUG_COUNT_FRAME_RETRIES).
const char * busName(Bus b, fl::u8 which=0) FL_NO_EXCEPT
Definition bus.h:176
fl::u32 millis() FL_NO_EXCEPT
Universal millisecond timer - returns milliseconds since system startup.
fl::u32 micros() FL_NO_EXCEPT
Universal microsecond timer - returns microseconds since system startup.
FiveBitSemantics
const char * busDriverName(Bus b, fl::u8 which=0, bool spi=false) FL_NO_EXCEPT
Concrete ChannelManager driver name for a portable bus.
Definition bus.h:193
u8 hdMinimumField(FiveBitSemantics semantics, u8 floor_setting) FL_NO_EXCEPT
The lowest field the managed HD path may choose: the configured flicker floor for a secondary slow-PW...
Bus
Portable public bus selector.
Definition bus.h:31
@ AUTO
Definition bus.h:32
void yield() FL_NO_EXCEPT
Yield to the platform scheduler.
Definition yield.cpp.hpp:32
u32 _frame_cnt
Frame counter for ESP8266 clockless drivers (FASTLED_DEBUG_COUNT_FRAME_RETRIES).
PowerCodecPolicy powerChannelCodecPolicy(const CLEDController &controller) FL_NO_EXCEPT
Identify the channel's final current/quantization choice without adding a virtual slot or storage to ...
@ LPD6803
LPD6803 LED chipset.
@ APA102HD
APA102 LED chipset with 5-bit gamma correction.
@ DOTSTARHD
APA102HD LED chipset alias.
@ SK9822HD
SK9822 LED chipset with 5-bit gamma correction.
@ LPD8806
LPD8806 LED chipset.
@ HD107HD
Same as APA102HD, but in turbo 40-mhz mode.
FiveBitSemantics fiveBitSemanticsFor(SpiChipset chip, FiveBitSemantics profile) FL_NO_EXCEPT
The 5-bit semantics for chip, with profile overriding the chip's default when it is not NotApplicable...
Base definition for an LED controller.
PowerCodecKind kind
Driver state information for channel manager.
Definition manager.h:39
Result of the shared frame-budget prepass on large-memory managed output.
Cross-platform facade for runtime network activity detection.
static fl::u32 fixed_power_mW(fl::u32 led_count) FL_NO_EXCEPT
#define FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS
#define FL_DISABLE_WARNING_PUSH
#define FL_KEEP_ALIVE
#define FL_RUN_ONCE(code)
#define FL_DISABLE_WARNING_POP
#define FL_NO_EXCEPT
#define FL_MAYBE_UNUSED
#define FL_LINK_WEAK
fl::u8 dark_mW
Dark (all channels off) draw per LED IC, in milliwatts, charged as an undimmable baseline.
Definition power_mgt.h:41
Configuration for a single LED channel.
Definition config.h:167
static ChannelEvents & instance() FL_NO_EXCEPT
Singleton event router for Channel lifecycle events.
SPI chipset configuration (data + clock pins)
Definition config.h:103
#define FL_SCOPED_TRACE
Definition trace.h:128
Runtime-tunable microsecond spin budget for the channel-manager and driver wait loops (Phase 1 of #28...
Platform-aware cooperative yield for FastLED.