FastLED 3.9.15
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 36 of file ws2816.h.

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

References make_pair().

Referenced by encodeWS2816().

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