FastLED 3.9.15
Loading...
Searching...
No Matches

◆ encodeWS2801()

template<typename InputIterator, typename OutputIterator>
void fl::encodeWS2801 ( InputIterator first,
InputIterator last,
OutputIterator out )

Encode pixel data in WS2801/WS2803 format.

Writes RGB pixel data in WS2801 protocol format. WS2801 is one of the simplest SPI protocols - just 3 bytes per LED (RGB) with no start/end frames. Latching occurs via timing (pause in clock).

Template Parameters
InputIteratorIterator yielding fl::array<u8, 3> (3 bytes in wire order)
OutputIteratorOutput iterator accepting uint8_t (e.g., fl::back_inserter)
Parameters
firstIterator to first pixel
lastIterator past last pixel
outOutput iterator for encoded bytes
Note
WS2803 uses identical protocol to WS2801 (just different default clock speed)
Writes 3 bytes per pixel in wire order
WS2801 uses RGB wire order: pixel[0]=Red, pixel[1]=Green, pixel[2]=Blue

Definition at line 41 of file ws2801.h.

41 {
42 while (first != last) {
43 const array<u8, BYTES_PER_PIXEL_RGB>& pixel = *first;
44 *out++ = pixel[0]; // Index 0 (RGB order: Red)
45 *out++ = pixel[1]; // Index 1 (RGB order: Green)
46 *out++ = pixel[2]; // Index 2 (RGB order: Blue)
47 ++first;
48 }
49 // No end frame needed - WS2801 latches via timing (clock pause)
50}
A fixed-size array implementation similar to std::array.
Definition array.h:27

References FL_NOEXCEPT.

Referenced by encodeWS2803(), and fl::PixelIterator::writeWS2801().

+ Here is the caller graph for this function: