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

Detailed Description

Adapter that wraps HW SPI controllers for ChannelManager.

This adapter implements the IChannelDriver interface by delegating to existing SpiHwBase controllers (SpiHw1/2/4/8/16). It handles channel data batching, transmission coordination, and polling state management.

Definition at line 64 of file spi_channel_adapter.h.

#include <spi_channel_adapter.h>

+ Inheritance diagram for fl::SpiChannelEngineAdapter:
+ Collaboration diagram for fl::SpiChannelEngineAdapter:

Classes

struct  ClockPinAssignment
 
struct  ClockPinGroup
 Group data structure for channels with same clock pin. More...
 
struct  ControllerInfo
 Information about a registered SPI hardware controller. More...
 

Public Member Functions

 ~SpiChannelEngineAdapter () FL_NOEXCEPT override
 Destructor.
 
bool canHandle (const ChannelDataPtr &data) const override
 Check if adapter can handle channel data.
 
void enqueue (ChannelDataPtr channelData) override
 Enqueue channel data for transmission.
 
Capabilities getCapabilities () const override
 Get driver capabilities (SPI protocols only)
 
fl::string getName () const override
 Get adapter name for debugging.
 
int getPriority () const
 Get maximum priority among all controllers.
 
DriverState poll () override
 Query driver state and perform maintenance.
 
void show () override
 Trigger transmission of enqueued data.
 
- Public Member Functions inherited from fl::IChannelDriver
virtual ~IChannelDriver () FL_NOEXCEPT=default
 Virtual destructor.
 
virtual void setPollNeededCallback (PollNeededCallback callback) FL_NOEXCEPT
 Install the manager-owned poll-needed callback for ISR wakeups.
 
virtual bool waitDone (u32 timeoutMs=1000) FL_NOEXCEPT
 Block until this driver finishes any in-flight transmit.
 
bool waitForReady (u32 timeoutMs=1000) FL_NOEXCEPT
 Wait for driver to become READY.
 
bool waitForReadyOrDraining (u32 timeoutMs=1000) FL_NOEXCEPT
 

Static Public Member Functions

static fl::shared_ptr< SpiChannelEngineAdaptercreate (fl::vector< fl::shared_ptr< SpiHwBase > > hwControllers, fl::vector< int > priorities, fl::vector< const char * > names, const char *adapterName)
 Create unified adapter managing multiple controllers.
 

Private Member Functions

 SpiChannelEngineAdapter (const char *name)
 Private constructor - use create() factory method.
 
 SpiChannelEngineAdapter (const SpiChannelEngineAdapter &) FL_NOEXCEPT=delete
 
 SpiChannelEngineAdapter (SpiChannelEngineAdapter &&) FL_NOEXCEPT=delete
 
bool canControllerHandleClockPin (const ControllerInfo &ctrl, int clockPin) const
 Check if controller can handle this clock pin.
 
fl::vector< ClockPinGroupgroupByClockPin (fl::span< const ChannelDataPtr > channels)
 Group channels by clock pin for efficient transmission.
 
bool initializeControllerIfNeeded (ControllerInfo &ctrl, int clockPin, int dataPin)
 Initialize controller if needed for this clock pin.
 
SpiChannelEngineAdapteroperator= (const SpiChannelEngineAdapter &) FL_NOEXCEPT=delete
 
SpiChannelEngineAdapteroperator= (SpiChannelEngineAdapter &&) FL_NOEXCEPT=delete
 
int selectControllerForClockPin (int clockPin)
 Select best controller for a given clock pin.
 
bool transmitBatch (fl::span< const ChannelDataPtr > channels)
 Transmit a batch of channels (all same clock pin)
 

Private Attributes

fl::vector< ClockPinAssignmentmClockPinAssignments
 Clock pin → controller mapping.
 
fl::vector< ControllerInfomControllers
 All managed controllers.
 
fl::vector< ChannelDataPtr > mEnqueuedChannels
 Channels waiting for show()
 
fl::string mName
 Engine name for debugging.
 
fl::vector< ChannelDataPtr > mTransmittingChannels
 Channels currently transmitting.
 

Friends

template<typename T, typename... Args>
fl::shared_ptr< T > fl::make_shared (Args &&... args) FL_NOEXCEPT
 Friend declaration for make_shared to access private constructor.
 

Additional Inherited Members

- Protected Member Functions inherited from fl::IChannelDriver
 IChannelDriver () FL_NOEXCEPT=default
 
 IChannelDriver (const IChannelDriver &) FL_NOEXCEPT=delete
 
 IChannelDriver (IChannelDriver &&) FL_NOEXCEPT=delete
 
IChannelDriveroperator= (const IChannelDriver &) FL_NOEXCEPT=delete
 
IChannelDriveroperator= (IChannelDriver &&) FL_NOEXCEPT=delete
 
template<typename Condition>
bool waitForCondition (Condition condition, u32 timeoutMs=1000) FL_NOEXCEPT
 

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