FastLED 3.9.15
Loading...
Searching...
No Matches

◆ add() [7/8]

fl::vector< fl::ChannelPtr > CFastLED::add ( fl::span< const fl::ChannelConfig > configs)
static

Add multiple LED channels from a config array.

Creates and registers multiple Channel-based LED controllers from an array of configurations. Returns a vector of shared_ptrs for lifetime control.

Parameters
configsSpan of ChannelConfig objects
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::ChannelConfig configs[] = {
fl::ChannelConfig(PIN1, timing, leds1, RGB),
fl::ChannelConfig(PIN2, timing, leds2, RGB)
};
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()
stored ChannelPtrs to keep them alive
constexpr EOrder RGB
Definition eorder.h:17
constexpr ChipsetTimingConfig makeTimingConfig() FL_NOEXCEPT
Convert compile-time CHIPSET type to runtime timing config.
Configuration for a single LED channel.
Definition config.h:163

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

648 {
649 fl::vector<fl::ChannelPtr> channels;
650 channels.reserve(configs.size());
651
652 for (const auto& config : configs) {
653 channels.push_back(add(config));
654 }
655
656 return channels;
657}
static void add(fl::ChannelPtr channel)
Add a Channel-based LED controller (from ChannelPtr)
constexpr fl::size size() const FL_NOEXCEPT
Definition span.h:458

References add(), channels(), and fl::span< T, Extent >::size().

+ Here is the call graph for this function: