FastLED 3.9.15
Loading...
Searching...
No Matches
fl::ChannelManager Class Reference

Detailed Description

Unified channel manager with priority-based driver selection.

This manager acts as a registry for concrete driver implementations (RMT, SPI, PARLIO). Channels select drivers via selectDriverForChannel() and bind directly to them via weak_ptr.

Platform-specific code registers drivers during static initialization.

Definition at line 50 of file manager.h.

#include <manager.h>

+ Inheritance diagram for fl::ChannelManager:
+ Collaboration diagram for fl::ChannelManager:

Classes

struct  EngineEntry
 Engine registry entry (priority + shared pointer + runtime control) More...
 

Public Types

enum class  DriverStatus { NOT_REGISTERED , STATUS_DISABLED , STATUS_ENABLED }
 Registration status of a driver by name (silent lookup) More...
 

Public Member Functions

 ChannelManager () FL_NOEXCEPT
 Constructor.
 
 ~ChannelManager () FL_NOEXCEPT override
 Destructor - cleanup shared drivers (automatic via shared_ptr)
 
void addDriver (int priority, fl::shared_ptr< IChannelDriver > driver) FL_NOEXCEPT
 Add a driver with priority (higher priority = preferred)
 
void clearAllDrivers () FL_NOEXCEPT
 Remove all drivers from the manager.
 
DriverStatus driverStatus (const fl::string &name) const FL_NOEXCEPT
 Look up a driver's registration status without logging on miss.
 
const fl::stringexclusiveDriverName () const FL_NOEXCEPT
 Get the currently-active exclusive-driver selection (if any).
 
fl::shared_ptr< IChannelDriverfindDriverByName (const fl::string &name) const FL_NOEXCEPT
 Silent counterpart to getDriverByName().
 
fl::shared_ptr< IChannelDrivergetDriverByName (const fl::string &name) const FL_NOEXCEPT
 Get driver by name for affinity binding.
 
fl::size getDriverCount () const FL_NOEXCEPT
 Get count of registered drivers (including unnamed ones)
 
fl::span< const DriverInfogetDriverInfos () const FL_NOEXCEPT
 Get full state of all registered drivers.
 
bool isDriverEnabled (const char *name) const FL_NOEXCEPT
 Check if a driver is enabled by name.
 
void onBeginFrame () FL_NOEXCEPT override
 Poll drivers before frame starts to clear previous frame state.
 
void onEndFrame () FL_NOEXCEPT override
 Trigger transmission of batched channel data.
 
IChannelDriver::DriverState poll () FL_NOEXCEPT
 Poll all registered drivers and return aggregate state.
 
bool removeDriver (fl::shared_ptr< IChannelDriver > driver) FL_NOEXCEPT
 Remove a driver from the manager.
 
void reset () FL_NOEXCEPT
 Reset bus manager state, clearing all enqueued and transmitting channels.
 
fl::shared_ptr< IChannelDriverselectDriverForChannel (const ChannelDataPtr &data, const fl::string &affinity) FL_NOEXCEPT
 Select best driver for channel data (used by Channel::showPixels)
 
void setDriverEnabled (const char *name, bool enabled) FL_NOEXCEPT
 Enable or disable a driver by name at runtime.
 
bool setDriverPriority (const fl::string &name, int priority) FL_NOEXCEPT
 Change the priority of a registered driver.
 
template<fl::Bus B>
void setExclusiveDriver () FL_NOEXCEPT
 Register a single driver at a priority above the platform default and disable all others (compile-time TU-linking variant).
 
bool setExclusiveDriver (Bus bus) FL_NOEXCEPT
 Enable only one driver exclusively, by fl::Bus enum (runtime form).
 
bool setExclusiveDriverByName (const char *name) FL_NOEXCEPT
 Enable only one driver exclusively (disables all others) — by-name escape hatch.
 
bool waitForReady (u32 timeoutMs=1000) FL_NOEXCEPT
 Wait for all drivers to become READY.
 
bool waitForReadyOrDraining (u32 timeoutMs=1000) FL_NOEXCEPT
 
- Public Member Functions inherited from fl::EngineEvents::Listener
 Listener () FL_NOEXCEPT
 
virtual ~Listener () FL_NOEXCEPT
 
virtual void onCanvasUiSet (CLEDController *strip, const ScreenMap &screenmap) FL_NOEXCEPT
 
virtual void onEndShowLeds () FL_NOEXCEPT
 
virtual void onExit () FL_NOEXCEPT
 
virtual void onPlatformPreLoop () FL_NOEXCEPT
 
virtual void onPlatformPreLoop2 () FL_NOEXCEPT
 
virtual void onStripAdded (CLEDController *strip, fl::u32 num_leds) FL_NOEXCEPT
 

Static Public Member Functions

static ChannelManagerinstance () FL_NOEXCEPT
 Get the global singleton instance.
 

Private Member Functions

 ChannelManager (ChannelManager &&) FL_NOEXCEPT=delete
 
 ChannelManager (const ChannelManager &) FL_NOEXCEPT=delete
 
void notifyPollNeeded () FL_NOEXCEPT
 
ChannelManageroperator= (ChannelManager &&) FL_NOEXCEPT=delete
 
ChannelManageroperator= (const ChannelManager &) FL_NOEXCEPT=delete
 
u32 pollNeededWaitSliceMs (u32 startTime, u32 timeoutMs) const FL_NOEXCEPT
 
IChannelDriverselectDriver (const ChannelDataPtr &data=nullptr) FL_NOEXCEPT
 Select driver for current operation.
 
template<typename Condition>
bool waitForCondition (Condition condition, u32 timeoutMs=1000) FL_NOEXCEPT
 Wait until a condition is met, with check-pump-delay logic.
 
bool waitForPollNeededSignal (u32 timeoutMs) FL_NOEXCEPT
 

Static Private Member Functions

static void notifyPollNeededThunk (void *context) FL_NOEXCEPT
 

Private Attributes

fl::vector< DriverInfomCachedDriverInfo
 Cached driver info for getDriverInfos() to avoid allocations.
 
fl::vector< EngineEntrymDrivers
 Shared drivers sorted by priority descending (higher values first)
 
fl::string mExclusiveDriver
 Exclusive driver name (empty if no exclusive mode)
 
IChannelDriver::PollNeededCallback mPollNeededCallback
 Shared callback installed on drivers that can signal poll-needed events.
 
platforms::ChannelPollSignal mPollNeededSignal
 Platform wait primitive owned by the manager.
 

The documentation for this class was generated from the following files: