FastLED 3.9.15
Loading...
Searching...
No Matches
spi_channel_adapter.h File Reference

Detailed Description

Adapter that wraps HW SPI controllers for ChannelManager.

This adapter enables existing SpiHw1/2/4/8/16 controllers to work with the modern channel-based API while maintaining backward compatibility with SPIBusManager. It uses the Adapter pattern to wrap platform-specific hardware controllers without modification.

Architecture Overview:

Application Code (APA102 strips)
ChannelManager (proxy)
SpiChannelEngineAdapter (this file)
SpiHw1/2/4/8/16 (existing, unchanged)
Platform Hardware (DMA, SPI peripheral)
@ APA102
APA102 LED chipset.
Definition FastLED.h:262

Critical Distinction: This adapter is for TRUE SPI chipsets (APA102, SK9822, HD108) that require synchronized clock signals. This is fundamentally different from ChannelEngineSpi, which implements clockless protocols (WS2812) using SPI hardware as a bit-banging driver.

Adapter Chipsets Clock Pin Usage Purpose
SpiChannelEngineAdapter APA102, SK9822 Connected to LEDs True SPI
ChannelEngineSpi WS2812, SK6812 Internal only Clockless-over-SPI

Priority Scheme: True SPI adapters are registered with higher priority than clockless drivers:

  • SPI_HEXADECA (priority 9): 16-lane true SPI
  • SPI_OCTAL (priority 8): 8-lane true SPI
  • SPI_QUAD (priority 7): 4-lane true SPI
  • SPI_DUAL (priority 6): 2-lane true SPI
  • SPI_SINGLE (priority 5): 1-lane true SPI
  • PARLIO (priority 4): Clockless parallel I/O
  • ... (lower priority clockless drivers)

Definition in file spi_channel_adapter.h.

#include "fl/stl/noexcept.h"
#include "fl/channels/driver.h"
#include "fl/channels/data.h"
#include "fl/stl/vector.h"
#include "fl/stl/shared_ptr.h"
#include "fl/stl/string.h"
#include "platforms/shared/spi_hw_base.h"
+ Include dependency graph for spi_channel_adapter.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  fl::SpiChannelEngineAdapter
 Adapter that wraps HW SPI controllers for ChannelManager. More...
 
struct  fl::SpiChannelEngineAdapter::ClockPinAssignment
 
struct  fl::SpiChannelEngineAdapter::ClockPinGroup
 Group data structure for channels with same clock pin. More...
 
struct  fl::SpiChannelEngineAdapter::ControllerInfo
 Information about a registered SPI hardware controller. More...
 

Namespaces

namespace  fl
 Base definition for an LED controller.
 

Class Documentation

◆ fl::SpiChannelEngineAdapter::ClockPinAssignment

struct fl::SpiChannelEngineAdapter::ClockPinAssignment
Class Members
int clockPin
size_t controllerIndex Index into mControllers.

◆ fl::SpiChannelEngineAdapter::ClockPinGroup

struct fl::SpiChannelEngineAdapter::ClockPinGroup
+ Collaboration diagram for fl::SpiChannelEngineAdapter::ClockPinGroup:
Class Members
vector< ChannelDataPtr > channels
int clockPin