FastLED 3.9.15
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
30template<fl::Bus B> struct BusTraits;
31
45template<fl::Bus B, typename Chipset>
47
48namespace detail {
49
53template<Bus B>
58
59} // namespace detail
60
79template<Bus... Buses>
81 // C++11-compatible pack expansion via array initializer trick.
82 using expand = int[];
83 (void)expand{0, detail::bus_register_one<Buses>()...};
84}
85
94namespace detail {
95
96template<fl::Bus B>
98 static inline void odr_use() FL_NOEXCEPT {
99 // ODR-use the singleton accessor's address — sufficient to keep
100 // the driver TU alive. We do NOT call `instance()` here because
101 // some platforms construct the driver eagerly inside the Meyers
102 // singleton and we want `Bus::X`-tagged `addLeds<>` to behave as
103 // a pure compile-time annotation (no runtime side effect beyond
104 // the linker keep-alive itself).
106 }
107};
108
109template<>
111 static inline void odr_use() FL_NOEXCEPT {} // AUTO: no pinning, no ODR-use.
112};
113
114} // namespace detail
115
116template<fl::Bus B>
120
121} // namespace fl
Compile-time identifier for an LED channel transmission bus.
int bus_register_one() FL_NOEXCEPT
Helper used by enableDrivers<Bus...>() to expand the parameter pack.
Definition bus_traits.h:54
Compile-time linker keep-alive hook for a single fl::Bus.
Definition bus_traits.h:48
integral_constant< bool, false > false_type
Definition s16x16x4.h:28
Bus
Driver identifier for compile-time bus selection.
Definition bus.h:60
@ AUTO
Sentinel: defer to DefaultBus<Chipset>::value.
Definition bus.h:61
void busKeepAlive() FL_NOEXCEPT
Definition bus_traits.h:117
void enableDrivers() FL_NOEXCEPT
Register the named drivers with ChannelManager for runtime selection.
Definition bus_traits.h:80
Base definition for an LED controller.
Definition crgb.hpp:179
Primary template — intentionally undefined.
Definition bus_traits.h:30
#define FL_NOEXCEPT
Capability check: does bus B accept chipset family Chipset?
Definition bus_traits.h:46
static void odr_use() FL_NOEXCEPT
Definition bus_traits.h:98