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

◆ encodeWS2812_RGB()

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

Encode 3-byte pixel data in WS2812 format.

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
Writes 3 bytes per pixel in whatever color order they're already in

Definition at line 35 of file ws2812.h.

35 {
36 while (first != last) {
37 const fl::array<u8, BYTES_PER_PIXEL_RGB>& pixel = *first;
38 *out++ = pixel[0]; // First byte
39 *out++ = pixel[1]; // Second byte
40 *out++ = pixel[2]; // Third byte
41 ++first;
42 }
43}
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: