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

Detailed Description

Parallel GPIO SPI device (1-32 pins driven from single data stream)

Uses lookup table (LUT) to map byte values to GPIO pin states. Single data stream drives all pins simultaneously. Backend: SpiIsr* (ISR-driven) or SpiBlock* (bit-bang)

Architecture:

  • Single data stream (byte sequence)
  • 256-entry LUT maps each byte value → GPIO pin states
  • Each data byte controls multiple GPIO pins via SET/CLEAR masks
  • ISR mode: Timer-driven interrupts (async, ~1.6MHz → 800kHz SPI)
  • Bit-bang mode: Main thread inline (blocking, higher potential speed)

Example:

config.clock_pin = 18;
config.gpio_pins = {0,1,2,3,4,5,6,7}; // 8 parallel outputs
spi.begin();
uint8_t data[] = {0xFF, 0x00, 0xAA}; // Same to all 8 pins
auto tx = spi.write(data, sizeof(data));
tx.wait();
Parallel GPIO SPI device (1-32 pins driven from single data stream)
@ AUTO
Auto-select best mode (default: ISR)
Definition config.h:34
unsigned char uint8_t
Definition s16x16x4.h:209
fl::vector< u8 > gpio_pins
GPIO pins (1-32 pins)
SpiParallelMode mode
Execution mode (ISR vs bit-bang)
Configuration for parallel GPIO SPI.

Definition at line 65 of file parallel_device.h.

#include <parallel_device.h>

+ Collaboration diagram for fl::spi::ParallelDevice:

Classes

struct  Config
 Configuration for parallel GPIO SPI. More...
 
struct  Impl
 

Public Member Functions

 ParallelDevice (const Config &config)
 Construct parallel device.
 
 ParallelDevice (const ParallelDevice &) FL_NOEXCEPT=delete
 
 ParallelDevice (ParallelDevice &&) FL_NOEXCEPT=delete
 
 ~ParallelDevice () FL_NOEXCEPT
 Destructor - releases hardware resources.
 
fl::optional< fl::task::Error > begin ()
 Initialize hardware and setup LUT.
 
void configureLUT (const u32 *set_masks, const u32 *clear_masks)
 Configure custom LUT (advanced)
 
void end ()
 Shutdown hardware and release resources.
 
const Config & getConfig () const
 Get current configuration.
 
bool isBusy () const
 Check if transmission is in progress.
 
bool isReady () const
 Check if device is initialized.
 
ParallelDevice & operator= (const ParallelDevice &) FL_NOEXCEPT=delete
 
ParallelDevice & operator= (ParallelDevice &&) FL_NOEXCEPT=delete
 
bool waitComplete (u32 timeout_ms=(fl::numeric_limits< u32 >::max)())
 Wait for pending transmission to complete.
 
Result< Transaction > write (const u8 *data, size_t size)
 Write data (single stream drives all pins via LUT)
 

Private Attributes

fl::unique_ptr< Impl > pImpl
 

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