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

◆ encodeTM1908()

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

Encode one complete TM1908 frame.

TM1908 V1.2 requires every frame to begin with the 48-bit normal-mode command (0xFFFFFF followed by its inverse 0x000000), then a 24-bit current command. The maximum in-spec 25 mA setting is 0x7F for each channel; bit 7 is reserved and must remain zero. Pixel PWM data follows in RGB wire order.

Definition at line 18 of file tm1908.h.

19 {
20 const u8 prefix[] = {
21 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, // normal-mode command
22 0x7f, 0x7f, 0x7f, // 25 mA R/G/B current
23 };
24 for (u8 byte : prefix) {
25 *out++ = byte;
26 }
27
28 while (first != last) {
29 const auto& pixel = *first;
30 *out++ = pixel[0];
31 *out++ = pixel[1];
32 *out++ = pixel[2];
33 ++first;
34 }
35}
unsigned char u8
Definition stdint.h:131
uint8_t byte
Definition midi_Defs.h:36
unsigned char u8
Definition stdint.h:131

References FL_NO_EXCEPT.

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

+ Here is the caller graph for this function: