FastLED 3.10.8
Loading...
Searching...
No Matches

◆ add() [4/9]

fl::vector< fl::ChannelPtr > CFastLED::add ( const fl::MultiChannelConfig & multiConfig)
static

Add multiple LED channels from a MultiChannelConfig.

Creates and registers multiple Channel-based LED controllers from a MultiChannelConfig. Returns handles for later inspection, reconfiguration, or removal. FastLED retains its own references until remove(channel) is called for each channel.

Parameters
multiConfigMultiChannelConfig containing multiple channel configurations
Returns
Vector of ChannelPtrs (one per config), or empty elements if unsupported
Note
Supported platforms: ESP32, ESP32-S2, ESP32-S3, ESP32-C3, ESP32-C6, ESP32-P4

Example:

fl::MultiChannelConfig multiConfig = {
fl::ChannelConfig(PIN1, timing, leds1, RGB),
fl::ChannelConfig(PIN2, timing, leds2, RGB)
};
auto channels = FastLED.add(multiConfig);
CRGB leds2[lengths[RedStrip]]
CRGB leds1[lengths[GreenStrip]]
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
static fl::vector< fl::ChannelPtr > & channels() FL_NO_EXCEPT
stored ChannelPtrs to keep them alive
constexpr EOrder RGB
Definition eorder.h:17
constexpr ChipsetTimingConfig makeTimingConfig() FL_NO_EXCEPT
Convert compile-time CHIPSET type to runtime timing config.
Configuration for a single LED channel.
Definition config.h:167

Definition at line 871 of file FastLED.cpp.hpp.

871 {
872 fl::vector<fl::ChannelPtr> channels;
873 channels.reserve(multiConfig.mChannels.size());
874
875 for (const auto& configPtr : multiConfig.mChannels) {
876 if (configPtr) {
877 channels.push_back(add(*configPtr));
878 }
879 }
880
881 return channels;
882}
static void add(fl::ChannelPtr channel) FL_NO_EXCEPT
Add a Channel-based LED controller (from ChannelPtr)
fl::size size() const FL_NO_EXCEPT
fl::vector< ChannelConfigPtr > mChannels
Vector of shared pointers to channel configurations.
Definition config.h:396

References add(), channels(), and FL_NO_EXCEPT.

+ Here is the call graph for this function: