FastLED 3.10.6
Loading...
Searching...
No Matches

◆ encodeTM1812_RGBWW()

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

Pack 5-channel RGBCCT pixels into TM1812 12-channel frames.

The TM1812 consumes four RGB groups (12 bytes / 96 bits) per IC. RGBCCT strips reported in issue #995 wire two logical 5-channel pixels to the first ten outputs and leave the final two outputs unused. Consequently, each IC frame is pixel 0 (5) + pixel 1 (5) + zero padding (2).

An odd final logical pixel is followed by five zero bytes for the absent second pixel, then the normal two padding bytes. This preserves the 96-bit boundary so downstream TM1812 chips stay aligned.

Definition at line 24 of file tm1812.h.

25 {
26 while (first != last) {
27 const fl::array<u8, BYTES_PER_PIXEL_RGBWW>& firstPixel = *first;
28 for (u8 byte : firstPixel) {
29 *out++ = byte;
30 }
31 ++first;
32
33 if (first != last) {
34 const fl::array<u8, BYTES_PER_PIXEL_RGBWW>& secondPixel = *first;
35 for (u8 byte : secondPixel) {
36 *out++ = byte;
37 }
38 ++first;
39 } else {
40 for (u8 i = 0; i < BYTES_PER_PIXEL_RGBWW; ++i) {
41 *out++ = 0;
42 }
43 }
44
45 *out++ = 0;
46 *out++ = 0;
47 }
48}
A fixed-size array implementation similar to std::array.
Definition array.h:27
unsigned char u8
Definition stdint.h:131
uint8_t byte
Definition midi_Defs.h:36
unsigned char u8
Definition stdint.h:131
constexpr size_t BYTES_PER_PIXEL_RGBWW
Number of bytes per RGBWW pixel (order-agnostic, issue #2558).

References BYTES_PER_PIXEL_RGBWW, and FL_NO_EXCEPT.

Referenced by fl::PixelIterator::writeTM1812RGBWW().

+ Here is the caller graph for this function: