FastLED 3.10.10
Loading...
Searching...
No Matches
bus_traits.h
Go to the documentation of this file.
1#pragma once
2
17
18#include "fl/channels/bus.h"
19#include "fl/stl/noexcept.h"
20#include "fl/stl/type_traits.h"
21
22namespace fl {
23
31template<fl::Bus B, fl::u8 Which = 0> struct BusTraits;
32
46template<fl::Bus B, typename Chipset, fl::u8 Which = 0>
48
51template<fl::Bus B, fl::u8 Which = 0>
53
54namespace detail {
55
61template<typename Traits>
63 -> decltype(Traits::enableClockless(), void()) {
64 Traits::enableClockless();
65}
66template<typename Traits>
68template<typename Traits>
72
75template<typename Chipset, typename Traits>
77 static void apply() FL_NO_EXCEPT {}
78};
79template<typename Traits>
83
87
88template<Bus B, fl::u8 Which = 0>
90 // Explicitly enabling a bus makes it eligible for clockless channels too.
93 return 0;
94}
95
96} // namespace detail
97
116template<Bus... Buses>
118 // C++11-compatible pack expansion via array initializer trick.
119 using expand = int[];
120 (void)expand{0, detail::bus_register_one<Buses>()...};
121}
122
123template<Bus B, fl::u8 Which = 0>
127
136namespace detail {
137
138template<fl::Bus B, fl::u8 Which = 0>
140 static inline void odr_use() FL_NO_EXCEPT {
141 // ODR-use the singleton accessor's address — sufficient to keep
142 // the driver TU alive. We do NOT call `instance()` here because
143 // some platforms construct the driver eagerly inside the Meyers
144 // singleton and we want `Bus::X`-tagged `addLeds<>` to behave as
145 // a pure compile-time annotation (no runtime side effect beyond
146 // the linker keep-alive itself).
148 }
149};
150
151template<fl::u8 Which>
153 static inline void odr_use() FL_NO_EXCEPT {} // AUTO: no pinning, no ODR-use.
154};
155
156} // namespace detail
157
158template<fl::Bus B, fl::u8 Which = 0>
162
163} // namespace fl
Portable compile-time identifiers for LED channel buses.
int bus_register_one() FL_NO_EXCEPT
Helper used by enableDrivers<Bus...>() to expand the parameter pack.
Definition bus_traits.h:89
auto enable_clockless_impl(int) FL_NO_EXCEPT -> decltype(Traits::enableClockless(), void())
Call Traits::enableClockless() when the bus provides one.
Definition bus_traits.h:62
void enable_clockless() FL_NO_EXCEPT
Definition bus_traits.h:69
Compile-time linker keep-alive hook for a single fl::Bus.
Definition bus_info.h:57
integral_constant< bool, false > false_type
Definition s16x16x4.h:29
u8 u8 fract8 blur_amount FL_NO_EXCEPT
Definition blur.h:186
void busKeepAlive() FL_NO_EXCEPT
Definition bus_traits.h:159
Bus
Portable public bus selector.
Definition bus.h:31
@ AUTO
Definition bus.h:32
void enableDrivers() FL_NO_EXCEPT
Register the named drivers with ChannelManager for runtime selection.
Definition bus_traits.h:117
void enableDriver() FL_NO_EXCEPT
Definition bus_traits.h:124
Base definition for an LED controller.
Primary template — intentionally undefined.
Definition bus_traits.h:31
Capability check: does bus B accept chipset family Chipset?
Definition bus_traits.h:47
Whether a bus exposes configurable worker task affinity.
Definition bus_traits.h:52
Clockless chipset configuration (single data pin)
Definition config.h:33
static void odr_use() FL_NO_EXCEPT
Definition bus_traits.h:140
static void apply() FL_NO_EXCEPT
Definition bus_traits.h:77
enable_clockless<Traits>() only for the clockless chipset family.
Definition bus_traits.h:76