FastLED 3.10.8
Loading...
Searching...
No Matches

◆ packWS2816Pixel()

pair< CRGB, CRGB > fl::packWS2816Pixel ( u16 s0,
u16 s1,
u16 s2 )
inline

Pack a single 16-bit RGB pixel into two 8-bit CRGB pixels for WS2816.

Parameters
s0First 16-bit channel value (R)
s1Second 16-bit channel value (G)
s2Third 16-bit channel value (B)
Returns
Pair of CRGB pixels encoding the 16-bit values
Note
Channel layout: [R_hi, R_lo, G_hi] and [G_lo, B_hi, B_lo]

Definition at line 37 of file ws2816.h.

37 {
38 // Split each 16-bit channel into high/low bytes
39 u8 b0_hi = s0 >> 8;
40 u8 b0_lo = s0 & 0xFF;
41 u8 b1_hi = s1 >> 8;
42 u8 b1_lo = s1 & 0xFF;
43 u8 b2_hi = s2 >> 8;
44 u8 b2_lo = s2 & 0xFF;
45
46 // Pack into two CRGB pixels: [R_hi, R_lo, G_hi] and [G_lo, B_hi, B_lo]
47 return make_pair(
48 CRGB(b0_hi, b0_lo, b1_hi),
49 CRGB(b1_lo, b2_hi, b2_lo)
50 );
51}
pair< typename fl::decay< T1 >::type, typename fl::decay< T2 >::type > make_pair(T1 &&t, T2 &&u) FL_NO_EXCEPT
Definition pair.h:97
unsigned char u8
Definition stdint.h:131
fl::CRGB CRGB
Definition video.h:18

References FL_NO_EXCEPT, and fl::adl_barrier::make_pair().

Referenced by encodeWS2816().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: