MCPcopy Create free account
hub / github.com/FastLED/FastLED / decodeGains

Function decodeGains

tests/fl/chipsets/hd108.cpp:45–54  ·  view source on GitHub ↗

Helper to decode RGB gains from HD108 header bytes

Source from the content-addressed store, hash-verified

43
44/// Helper to decode RGB gains from HD108 header bytes
45void decodeGains(u8 f0, u8 f1, u8* r_gain, u8* g_gain, u8* b_gain) {
46 // f0: [1][RRRRR][GG] - marker bit, 5-bit R gain, 2 MSBs of G gain
47 *r_gain = (f0 >> 2) & 0x1F;
48 u8 g_msb = f0 & 0x03;
49
50 // f1: [GGG][BBBBB] - 3 LSBs of G gain, 5-bit B gain
51 u8 g_lsb = (f1 >> 5) & 0x07;
52 *g_gain = (g_msb << 3) | g_lsb;
53 *b_gain = f1 & 0x1F;
54}
55
56/// Helper to verify header bytes match expected RGB gains
57void checkHeaderBytes(u8 f0, u8 f1, u8 expected_r, u8 expected_g, u8 expected_b) {

Callers 1

checkHeaderBytesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected