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

◆ create() [1/3]

ChannelPtr fl::Channel::create ( const ChannelConfig & config)
static

Create a new channel with optional mBus driver pinning.

Parameters
configChannel configuration. If config.options.mBus is not Bus::AUTO, the channel pins itself to the driver named by busName(mBus) via ChannelManager::findDriverByName(). On a miss, showPixels() falls back to AUTO/priority dispatch and emits a one-shot FL_ERROR (see channel.cpp.hpp).
Returns
Shared pointer to channel (auto-cleanup when out of scope)
Note
Channels always use ChannelManager by default.

Definition at line 289 of file channel.cpp.hpp.

289 {
290 // Late binding strategy: Always create with empty driver
291 // Engine binding happens on first showPixels() call:
292 // - Affinity channels: Look up by name and cache
293 // - Non-affinity channels: Select dynamically each frame
294
295 auto channel = fl::make_shared<Channel>(config.chipset, config.mLeds,
296 config.rgb_order, config.options);
297 auto& events = ChannelEvents::instance();
298#if FL_COLOR_PROFILE_RUNTIME
299 if (channel->reconcileColorProfile(config.options)) {
300 events.onColorProfileFallback(
301 ColorProfileEvent{channel->id(), channel->colorProfileStatus(), {}});
302 }
303#endif
304 channel->mName = makeName(channel->mId, config.mName);
305 events.onChannelCreated(*channel);
306 return channel;
307}
static fl::string makeName(i32 id, const fl::optional< fl::string > &configName=fl::optional< fl::string >()) FL_NO_EXCEPT
shared_ptr< T > make_shared(Args &&... args) FL_NO_EXCEPT
Definition shared_ptr.h:423
static ChannelEvents & instance() FL_NO_EXCEPT

References fl::FL_NO_EXCEPT, fl::ChannelEvents::instance(), fl::adl_barrier::make_shared(), and makeName().

Referenced by create().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: