FastLED 3.9.15
Loading...
Searching...
No Matches
wait_spin_budget.cpp.hpp
Go to the documentation of this file.
1// IWYU pragma: private
2
5
7#include "fl/stl/atomic.h"
8
9#ifndef FASTLED_WAIT_SPIN_BUDGET_US
15#define FASTLED_WAIT_SPIN_BUDGET_US 250
16#endif
17
18namespace fl {
19namespace detail {
20
21namespace {
22 // Atomic so readers in waitForCondition do not race against a writer
23 // in CFastLED::setWaitSpinBudgetUs. On bare-metal (no real atomics)
24 // fl::atomic collapses to a plain integer, which is fine because
25 // non-FreeRTOS targets only access from one thread context.
27}
28
30 return sWaitSpinBudgetUs.load();
31}
32
33void setWaitSpinBudgetUs(fl::u32 budget_us) FL_NOEXCEPT {
34 sWaitSpinBudgetUs.store(budget_us);
35}
36
37} // namespace detail
38} // namespace fl
fl::u32 getWaitSpinBudgetUs() FL_NOEXCEPT
Get the current tiered-wait spin budget (microseconds).
void setWaitSpinBudgetUs(fl::u32 budget_us) FL_NOEXCEPT
Set the tiered-wait spin budget (microseconds).
AtomicFake< T > atomic
Definition atomic.h:26
Base definition for an LED controller.
Definition crgb.hpp:179
#define FL_NOEXCEPT
#define FASTLED_WAIT_SPIN_BUDGET_US
Default microsecond spin budget for the channel wait loops.
Runtime-tunable microsecond spin budget for the channel-manager and driver wait loops (Phase 1 of #28...