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

Detailed Description

Pre-computed nibble LUT for fast 8-pin digital writes.

Call init() once with your 8 pin numbers (-1 to skip a position), then call write() in your hot loop. Each byte in the data stream is split into two 4-bit nibbles; each nibble indexes into a 16-entry LUT that yields the pin indices to set HIGH or LOW — no per-bit branching.

Definition at line 28 of file pins.h.

#include <pins.h>

+ Collaboration diagram for fl::DigitalMultiWrite8:

Classes

struct  PinList
 

Public Member Functions

 DigitalMultiWrite8 () FL_NOEXCEPT=default
 
bool allSamePort () const
 Check whether all active pins (non -1) share the same GPIO port.
 
void init (const Pins8 &pins)
 Initialize from 8 pin numbers. -1 means "skip this bit position".
 
void write (fl::span< const u8 > pin_data) const
 Write pre-transposed byte data to the 8 pins.
 
void writeByte (u8 byte) const
 Write a single bitmask byte to the 8 pins.
 

Private Member Functions

void buildNibbleLut (u8 bit_offset, PinList(&set_lut)[16], PinList(&clr_lut)[16])
 

Static Private Member Functions

static void applyNibble (const PinList &set, const PinList &clr)
 

Private Attributes

PinList mClrHi [16] = {}
 
PinList mClrLo [16] = {}
 
int mPins [8] = {-1, -1, -1, -1, -1, -1, -1, -1}
 
PinList mSetHi [16] = {}
 
PinList mSetLo [16] = {}
 

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