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

◆ encodeWS2812_RGBW()

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

Encode 4-byte pixel data in WS2812 format.

Template Parameters
InputIteratorIterator yielding fl::array<u8, 4> (4 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
Writes 4 bytes per pixel in whatever color order they're already in

Definition at line 53 of file ws2812.h.

53 {
54 while (first != last) {
55 const fl::array<u8, BYTES_PER_PIXEL_RGBW>& pixel = *first;
56 *out++ = pixel[0]; // First byte
57 *out++ = pixel[1]; // Second byte
58 *out++ = pixel[2]; // Third byte
59 *out++ = pixel[3]; // Fourth byte
60 ++first;
61 }
62}
A fixed-size array implementation similar to std::array.
Definition array.h:27

References FL_NOEXCEPT.

Referenced by encodeWS2812(), and fl::PixelIterator::writeWS2812().

+ Here is the caller graph for this function: