FastLED 3.9.15
Loading...
Searching...
No Matches
fl::spi::MultiLaneDevice Class Reference

Detailed Description

Multi-lane SPI device (1-8 independent LED strips)

Manages one or more independent data streams that are transposed and transmitted in parallel using hardware DMA (SpiHw1/2/4/8)

Architecture:

  • Each lane has independent buffer (via Lane class)
  • User writes to each lane independently
  • flush() transposes all lanes and transmits via hardware
  • Auto-selects SpiHw1 (1 lane), SpiHw2 (2 lanes), SpiHw4 (3-4 lanes), or SpiHw8 (5-8 lanes)

Example:

config.clock_pin = 18;
config.data_pins = {23, 22, 21, 19}; // 4 lanes
spi.begin();
spi.lane(0).write(data0, size0);
spi.lane(1).write(data1, size1);
auto result = spi.flush();
if (result.ok()) {
spi.wait(); // Block until transmission completes
}
Multi-lane SPI device (1-8 independent LED strips)
expected< T, E > result
Alias for expected (Rust-style naming)
Definition result.h:31
u8 clock_pin
Shared clock pin (SCK)
fl::vector< u8 > data_pins
Data pins (1-8 pins)
Configuration for multi-lane SPI.

Definition at line 51 of file multi_lane_device.h.

#include <multi_lane_device.h>

+ Collaboration diagram for fl::spi::MultiLaneDevice:

Classes

struct  Config
 Configuration for multi-lane SPI. More...
 
struct  Impl
 

Public Member Functions

 MultiLaneDevice (const Config &config)
 Construct multi-lane device.
 
 MultiLaneDevice (const MultiLaneDevice &) FL_NOEXCEPT=delete
 
 MultiLaneDevice (MultiLaneDevice &&) FL_NOEXCEPT=delete
 
 ~MultiLaneDevice () FL_NOEXCEPT
 Destructor - releases hardware resources.
 
fl::optional< fl::task::Errorbegin ()
 Initialize hardware.
 
void end ()
 Shutdown hardware and release resources.
 
Result< void > flush ()
 Flush all lanes (transpose and transmit)
 
const ConfiggetConfig () const
 Get current configuration.
 
bool isBusy () const
 Check if transmission is in progress.
 
bool isReady () const
 Check if device is initialized.
 
Lanelane (size_t lane_id)
 Get access to a specific lane.
 
size_t numLanes () const
 Get number of lanes.
 
MultiLaneDeviceoperator= (const MultiLaneDevice &) FL_NOEXCEPT=delete
 
MultiLaneDeviceoperator= (MultiLaneDevice &&) FL_NOEXCEPT=delete
 
bool wait ()
 Convenience method - wait for transmission to complete.
 
bool waitComplete (u32 timeout_ms=(fl::numeric_limits< u32 >::max)())
 Wait for pending transmission to complete.
 
template<typename... Spans>
WriteResult write (Spans &&... lanes)
 Convenience method - write multiple lanes in parallel (variadic template)
 

Private Member Functions

WriteResult writeImpl (fl::span< const fl::span< const u8 > > lane_data)
 Internal implementation - write all lanes atomically.
 

Private Attributes

fl::unique_ptr< ImplpImpl
 

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