FastLED 3.10.10
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 291 of file channel.cpp.hpp.

291 {
292 // Late binding strategy: Always create with empty driver
293 // Engine binding happens on first showPixels() call:
294 // - Affinity channels: Look up by name and cache
295 // - Non-affinity channels: Select dynamically each frame
296
297 auto channel = fl::make_shared<Channel>(config.chipset, config.mLeds,
298 config.rgb_order, config.options);
299 auto& events = ChannelEvents::instance();
300#if FL_COLOR_PROFILE_RUNTIME
301 if (channel->reconcileColorProfile(config.options)) {
302 events.onColorProfileFallback(
303 ColorProfileEvent{channel->id(), channel->colorProfileStatus(), {}});
304 }
305#endif
306 channel->mName = makeName(channel->mId, config.mName);
307 events.onChannelCreated(*channel);
308 return channel;
309}
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: