34#include "platforms/channel_poll_signal.h"
138 template<fl::Bus B, fl::u8 Which = 0>
295 template<
typename Condition>
365 constexpr int kExclusivePriority = 10000;
Portable compile-time identifiers for LED channel buses.
Per-driver traits keyed on fl::Bus.
void onEndFrame() FL_NO_EXCEPT override
Trigger transmission of batched channel data.
void setDriverEnabled(const char *name, bool enabled) FL_NO_EXCEPT
Enable or disable a driver by name at runtime.
bool waitForReadyOrDraining(u32 timeoutMs=1000) FL_NO_EXCEPT
bool setExclusiveDriverByName(const char *name) FL_NO_EXCEPT
Enable only one driver exclusively (disables all others) — by-name escape hatch.
u32 pollNeededWaitSliceMs(u32 startTime, u32 timeoutMs) const FL_NO_EXCEPT
IChannelDriver * selectDriver(const ChannelDataPtr &data=nullptr) FL_NO_EXCEPT
Select driver for current operation.
void reset() FL_NO_EXCEPT
Reset bus manager state, clearing all enqueued and transmitting channels.
ChannelManager() FL_NO_EXCEPT
Constructor.
~ChannelManager() FL_NO_EXCEPT override
Destructor - cleanup shared drivers (automatic via shared_ptr)
const fl::string & exclusiveDriverName() const FL_NO_EXCEPT
Get the currently-active exclusive-driver selection (if any).
void onBeginFrame() FL_NO_EXCEPT override
Poll drivers before frame starts to clear previous frame state.
static ChannelManager & registry() FL_NO_EXCEPT
Get the singleton WITHOUT registering platform default drivers.
fl::shared_ptr< IChannelDriver > findDriverByName(const fl::string &name) const FL_NO_EXCEPT
Silent counterpart to getDriverByName().
fl::size getDriverCount() const FL_NO_EXCEPT
Get count of registered drivers (including unnamed ones)
IChannelDriver::DriverState poll() FL_NO_EXCEPT
Poll all registered drivers and return aggregate state.
void clearAllDrivers() FL_NO_EXCEPT
Remove all drivers from the manager.
static ChannelManager & instance() FL_NO_EXCEPT
Get the global singleton instance.
IChannelDriver::PollNeededCallback mPollNeededCallback
Shared callback installed on drivers that can signal poll-needed events.
DriverStatus driverStatus(const fl::string &name) const FL_NO_EXCEPT
Look up a driver's registration status without logging on miss.
FL_NO_INLINE FL_COLD bool addDriverSlow(int priority, const fl::shared_ptr< IChannelDriver > &driver, const fl::string *engineName, AddDriverSlowReason reason) FL_NO_EXCEPT
Handle validation failures and the uncommon replacement flow outside the normal driver-registration p...
platforms::ChannelPollSignal mPollNeededSignal
Platform wait primitive owned by the manager.
fl::vector< DriverInfo > mCachedDriverInfo
Cached driver info for getDriverInfos() to avoid allocations.
DriverStatus
Registration status of a driver by name (silent lookup)
@ NOT_REGISTERED
No driver with that name is registered.
@ STATUS_ENABLED
Driver is registered and enabled.
@ STATUS_DISABLED
Driver is registered but disabled.
void setExclusiveDriver() FL_NO_EXCEPT
Register a single driver at a priority above the platform default and disable all others (compile-tim...
fl::shared_ptr< IChannelDriver > getDriverByName(const fl::string &name) const FL_NO_EXCEPT
Get driver by name for affinity binding.
bool waitForCondition(Condition condition, u32 timeoutMs=1000) FL_NO_EXCEPT
Wait until a condition is met, with check-pump-delay logic.
fl::shared_ptr< IChannelDriver > selectDriverForChannel(const ChannelDataPtr &data, const fl::string &affinity) FL_NO_EXCEPT
Select best driver for channel data (used by Channel::showPixels)
fl::vector< EngineEntry > mDrivers
Shared drivers sorted by priority descending (higher values first)
fl::string mExclusiveDriver
Exclusive driver name (empty if no exclusive mode)
static void notifyPollNeededThunk(void *context) FL_NO_EXCEPT
bool setDriverPriority(const fl::string &name, int priority) FL_NO_EXCEPT
Change the priority of a registered driver.
bool waitForPollNeededSignal(u32 timeoutMs) FL_NO_EXCEPT
void addDriver(int priority, fl::shared_ptr< IChannelDriver > driver) FL_NO_EXCEPT
Add a driver with priority (higher priority = preferred)
bool isDriverEnabled(const char *name) const FL_NO_EXCEPT
Check if a driver is enabled by name.
void notifyPollNeeded() FL_NO_EXCEPT
bool removeDriver(fl::shared_ptr< IChannelDriver > driver) FL_NO_EXCEPT
Remove a driver from the manager.
bool waitForReady(u32 timeoutMs=1000) FL_NO_EXCEPT
Wait for all drivers to become READY.
fl::span< const DriverInfo > getDriverInfos() const FL_NO_EXCEPT
Get full state of all registered drivers.
Minimal interface for LED channel transmission drivers.
Channel transmission data - lightweight DTO for driver transmission.
void enable_clockless() FL_NO_EXCEPT
u8 u8 fract8 blur_amount FL_NO_EXCEPT
ChannelManager & channelManager() FL_NO_EXCEPT
Get the global ChannelManager singleton instance.
Bus
Portable public bus selector.
Base definition for an LED controller.
fl::string name
Driver name (empty for unnamed drivers)
bool enabled
Whether driver is currently enabled.
int priority
Driver priority (higher = preferred)
Driver state information for channel manager.
Primary template — intentionally undefined.
fl::string name
Engine name for runtime identification (e.g., "RMT", "SPI")
bool enabled
Runtime enable/disable flag.
fl::shared_ptr< IChannelDriver > driver
bool operator<(const EngineEntry &other) const FL_NO_EXCEPT
Sort by priority descending (higher numbers first)
Engine registry entry (priority + shared pointer + runtime control)