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

◆ encodeWS2816()

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

Encode 16-bit RGB pixel data into dual 8-bit RGB format for WS2816.

Template Parameters
InputIteratorIterator yielding fl::array<u16, 3> (16-bit RGB in wire order)
OutputIteratorOutput iterator accepting CRGB (e.g., raw pointer)
Parameters
firstIterator to first pixel
lastIterator past last pixel (sentinel)
outOutput iterator for encoded CRGB pairs
Note
Each input pixel yields 2 CRGB output pixels (48 bits → 2×24 bits)
Input iterator yields wire-ordered 16-bit RGB (reordering already done upstream)

Definition at line 61 of file ws2816.h.

61 {
62 while (first != last) {
63 // Get 16-bit RGB in wire order (already scaled, color-corrected, brightness-adjusted)
64 const array<u16, 3>& rgb16 = *first;
65 u16 s0 = rgb16[0];
66 u16 s1 = rgb16[1];
67 u16 s2 = rgb16[2];
68
69 // Use the packing helper function
70 pair<CRGB, CRGB> packed = packWS2816Pixel(s0, s1, s2);
71 *out++ = packed.first;
72 *out++ = packed.second;
73
74 ++first;
75 }
76}
A fixed-size array implementation similar to std::array.
Definition array.h:27
pair< CRGB, CRGB > packWS2816Pixel(u16 s0, u16 s1, u16 s2)
Pack a single 16-bit RGB pixel into two 8-bit CRGB pixels for WS2816.
Definition ws2816.h:36
T1 first
Definition pair.h:16
T2 second
Definition pair.h:17

References fl::pair< T1, T2 >::first, packWS2816Pixel(), and fl::pair< T1, T2 >::second.

+ Here is the call graph for this function: