FastLED 3.10.8
Loading...
Searching...
No Matches
config.cpp.hpp
Go to the documentation of this file.
1
3
5
6namespace fl {
7
8// ========== New Variant-Based Constructors ==========
9
15
22
25 : chipset(clockless)
26 , mLeds(leds)
27 , rgb_order(rgbOrder)
28 , options(options) {}
29
36
37// ========== Backwards-Compatible Constructors ==========
38
41 : chipset(ClocklessChipset(pin, timing))
42 , mLeds(leds)
43 , rgb_order(rgbOrder)
44 , options(options) {}
45
47 : chipset(other.chipset)
48 , mLeds(other.mLeds)
49 , rgb_order(other.rgb_order)
50 , options(other.options)
51 , mScreenMap(other.mScreenMap)
52 , mName(other.mName) {}
53
55 : chipset(fl::move(other.chipset))
56 , mLeds(other.mLeds)
57 , rgb_order(other.rgb_order)
58 , options(fl::move(other.options))
59 , mScreenMap(fl::move(other.mScreenMap))
60 , mName(fl::move(other.mName)) {}
61
62// ========== Accessor Methods ==========
63
65 if (const ClocklessChipset* clockless = chipset.ptr<ClocklessChipset>()) {
66 return clockless->pin;
67 } else if (const SpiChipsetConfig* spi = chipset.ptr<SpiChipsetConfig>()) {
68 return spi->dataPin;
69 }
70 return -1; // Invalid/empty variant
71}
72
74 if (const SpiChipsetConfig* spi = chipset.ptr<SpiChipsetConfig>()) {
75 return spi->clockPin;
76 }
77 return -1; // Clockless chipsets don't have a clock pin
78}
79
80// MultiChannelConfig constructors
81
88
89MultiChannelConfig::MultiChannelConfig(fl::initializer_list<ChannelConfig> channels) FL_NO_EXCEPT {
90 mChannels.reserve(channels.size());
91 for (const auto& config : channels) {
93 }
94}
95
97 mChannels.push_back(channel);
98 return *this;
99}
100
101} // namespace fl
CRGB leds[1]
constexpr remove_reference< T >::type && move(T &&t) FL_NO_EXCEPT
Definition move.h:30
shared_ptr< T > make_shared(Args &&... args) FL_NO_EXCEPT
Definition shared_ptr.h:423
u8 u8 fract8 blur_amount FL_NO_EXCEPT
Definition blur.h:186
fl::variant< ClocklessChipset, SpiChipsetConfig > ChipsetVariant
Definition config.h:157
EOrder
RGB color channel orderings, used when instantiating controllers to determine what order the controll...
Definition eorder.h:15
Base definition for an LED controller.
Definition crgb.hpp:179
ChannelConfig(const fl::string &name, const ChipsetVariant &chipset, fl::span< CRGB > leds, EOrder rgbOrder=RGB, const ChannelOptions &options=ChannelOptions()) FL_NO_EXCEPT
Named constructor with chipset variant.
fl::optional< fl::string > mName
Optional user-specified name (if not set, Channel generates one automatically)
Definition config.h:283
int getDataPin() const FL_NO_EXCEPT
Get data pin (works for both clockless and SPI)
int getClockPin() const FL_NO_EXCEPT
Get clock pin (returns -1 for clockless chipsets)
fl::ScreenMap mScreenMap
Screen mapping.
Definition config.h:280
ChannelOptions options
Optional channel settings (correction, temperature, dither, rgbw, affinity)
Definition config.h:277
fl::span< CRGB > mLeds
LED data array.
Definition config.h:271
ChipsetVariant chipset
Chipset configuration (clockless or SPI)
Definition config.h:268
EOrder rgb_order
RGB channel ordering.
Definition config.h:274
Optional channel configuration parameters All fields have sensible defaults and can be overridden as ...
Definition options.h:92
Runtime bit-period timing for a clockless chipset.
Clockless chipset configuration (single data pin)
Definition config.h:33
MultiChannelConfig & add(ChannelConfigPtr channel) FL_NO_EXCEPT
Add a channel configuration to the multi-channel config.
fl::vector< ChannelConfigPtr > mChannels
Vector of shared pointers to channel configurations.
Definition config.h:396
MultiChannelConfig() FL_NO_EXCEPT=default
SPI chipset configuration (data + clock pins)
Definition config.h:103