FastLED 3.10.10
Loading...
Searching...
No Matches
driver_bindings.h File Reference

Detailed Description

Opt-in, link-on-use channel driver bindings for FastLED.add(cfg).

FastLED.enable<fl::Bus::X>() self-adds one static DriverBinding node to the DriverBindings singleton. The node holds only a function pointer to that bus's registration; the driver itself is constructed the first time FastLED.add(cfg) needs it. Nothing else names the registration, so a bus that is never enabled never links (--gc-sections drops it).

FastLED.add(cfg) binds the node for the requested bus (or every node for Bus::AUTO) and, when no driver can serve the channel, warns once a second instead of linking every driver. FastLED.enableAllDrivers() remains the catch-all that registers every driver on the platform.

FastLED.enable<fl::Bus::RMT>().enable<fl::Bus::FLEX_IO>();
FastLED.add(cfg); // constructs RMT/FLEX_IO here, on first use
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
@ RMT
Definition bus.h:39

Definition in file driver_bindings.h.

#include "fl/channels/bus.h"
#include "fl/channels/bus_traits.h"
#include "fl/stl/int.h"
#include "fl/stl/noexcept.h"
#include "fl/stl/type_traits.h"
+ Include dependency graph for driver_bindings.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  fl::detail::BusBinding< B, Chipset, Which >
 
struct  fl::detail::CanBindBus< B, Chipset >
 False only for Bus::AUTO on a platform with no DefaultBus<Chipset>: there is no bus to name, so BusBinding must not be instantiated. More...
 
struct  fl::detail::HasDefaultBus< Chipset, typename >
 True when the platform specializes DefaultBus<Chipset>. More...
 
struct  fl::detail::HasDefaultBus< Chipset, decltype(void(DefaultBus< Chipset >::value))>
 
struct  fl::DriverBinding
 One enabled bus. Static storage, linked intrusively; never heap. More...
 
class  fl::DriverBindings
 Process-wide list of enabled buses. More...
 

Namespaces

namespace  fl
 Base definition for an LED controller.
 
namespace  fl::detail
 Compile-time linker keep-alive hook for a single fl::Bus.
 

Functions

template<typename Chipset>
bool fl::detail::bindDefaultDriver () FL_NO_EXCEPT
 Bind the platform default driver for Chipset, if one exists.
 
template<typename Chipset>
bool fl::detail::bindDefaultDriverImpl (fl::false_type) FL_NO_EXCEPT
 
template<typename Chipset>
bool fl::detail::bindDefaultDriverImpl (fl::true_type) FL_NO_EXCEPT
 
template<Bus B, typename Chipset = ClocklessChipset, u8 Which = 0>
void fl::bindDriver () FL_NO_EXCEPT
 Enable one bus for FastLED.add(cfg).
 
template<Bus B, typename Chipset, u8 Which>
void fl::detail::bindDriverImpl (fl::false_type) FL_NO_EXCEPT
 
template<Bus B, typename Chipset, u8 Which>
void fl::detail::bindDriverImpl (fl::true_type) FL_NO_EXCEPT
 

Class Documentation

◆ fl::DriverBinding

struct fl::DriverBinding
+ Collaboration diagram for fl::DriverBinding:
Class Members
void(*)() bind registers the driver with ChannelManager
Bus bus
bool listed
DriverBinding * next
u8 which