FastLED 3.10.6
Loading...
Searching...
No Matches
channel_typed.h
Go to the documentation of this file.
1#pragma once
2
28
29#include "fl/channels/bus.h"
31#include "fl/channels/channel.h"
32#include "fl/channels/config.h"
33#include "fl/stl/noexcept.h"
35#include "fl/stl/type_traits.h"
36
37namespace fl {
38
39namespace detail {
40
43template<Bus B, typename Chipset>
45 static constexpr Bus value = B;
46};
47
48template<typename Chipset>
49struct resolve_bus<Bus::AUTO, Chipset> {
51};
52
53} // namespace detail
54
67template<Bus B, typename Chipset, fl::u8 Which = 0>
69public:
72
73 // Compile-time contract: the named bus must accept this chipset family.
74 //
75 // The diagnostic message (suppressed on pre-C++17 toolchains by
76 // FL_STATIC_ASSERT) describes the contract: route ClocklessChipset to a
77 // clockless bus (RMT/PARLIO/I2S/...) and SpiChipsetConfig to an SPI bus.
80 "TypedChannel: Bus does not support this Chipset family");
81
87 static ChannelPtr create(const ChannelConfigOf<Chipset>& cfg) FL_NO_EXCEPT {
88 // Register only the compile-time-selected bus specialization and its
89 // associated driver(s). This retains the required translation unit(s)
90 // without pulling in enableAllDrivers().
92 ChannelConfig erased = cfg.toErased();
93 erased.options.mBus = kBus;
94 erased.options.mBusWhich = Which;
95 return Channel::create(erased);
96 }
97
104 static ChannelPtr create(const ChannelConfig& cfg) FL_NO_EXCEPT {
106 ChannelConfig erased = cfg;
107 erased.options.mBus = kBus;
108 erased.options.mBusWhich = Which;
109 return Channel::create(erased);
110 }
111
112private:
114};
115
116} // namespace fl
Portable compile-time identifiers for LED channel buses.
Per-driver traits keyed on fl::Bus.
ESP32-P4 Parallel IO (PARLIO) LED channel.
static ChannelPtr create(const ChannelConfigOf< Chipset > &cfg) FL_NO_EXCEPT
Construct a runtime Channel from a typed configuration.
TypedChannel() FL_NO_EXCEPT=delete
static ChannelPtr create(const ChannelConfig &cfg) FL_NO_EXCEPT
Overload accepting the (type-erased) non-template config.
static constexpr Bus kBus
The bus actually used after resolving Bus::AUTO.
FL_STATIC_ASSERT(BusSupports< kBus, Chipset, Which >::value, "TypedChannel: Bus does not support this Chipset family")
Compile-time linker keep-alive hook for a single fl::Bus.
Definition bus_info.h:57
FL_DISABLE_WARNING_PUSH unsigned char * B
Bus
Portable public bus selector.
Definition bus.h:27
@ AUTO
Definition bus.h:28
InputGamut g FL_NO_EXCEPT
Definition rgbw.h:121
Base definition for an LED controller.
Definition crgb.hpp:179
Primary template — intentionally undefined.
Definition bus_traits.h:31
Portable compile-time assertion wrapper.
ChannelOptions options
Optional channel settings (correction, temperature, dither, rgbw, affinity)
Definition config.h:277
Configuration for a single LED channel.
Definition config.h:167
Strongly-typed channel configuration with compile-time chipset family.
Definition config.h:307
static constexpr Bus value
Resolve a possibly-Bus::AUTO template argument to the concrete platform default for the given Chipset...