FastLED 3.9.15
Loading...
Searching...
No Matches

◆ hd108BrightnessHeader()

void fl::hd108BrightnessHeader ( u8 brightness_8bit,
u8 * f0_out,
u8 * f1_out )
inline

Generate HD108 per-channel gain header bytes.

Parameters
brightness_8bit8-bit brightness (0-255) - UNUSED, kept for API compatibility
f0_outOutput: first header byte
f1_outOutput: second header byte
Note
HD108 uses per-channel gain encoding: 5 bits each for R/G/B
All gains set to maximum (31) for maximum precision
Brightness control via 16-bit PWM values (applied before encoding)
Future: Per channel gain control for higher color range

Definition at line 80 of file encoder_utils.h.

80 {
81 (void)brightness_8bit; // Unused - brightness applied to 16-bit values instead
82
83 // Use maximum gain for all channels for maximum precision
84 // Brightness control happens via 16-bit PWM values
85 constexpr u8 r_gain = 31;
86 constexpr u8 g_gain = 31;
87 constexpr u8 b_gain = 31;
88
89 // Correct HD108 per-channel encoding:
90 // f0: [1][RRRRR][GG] - marker bit, 5-bit R gain, 2 MSBs of G gain
91 // f1: [GGG][BBBBB] - 3 LSBs of G gain, 5-bit B gain
92 *f0_out = 0x80 | ((r_gain & 0x1F) << 2) | ((g_gain >> 3) & 0x03);
93 *f1_out = ((g_gain & 0x07) << 5) | (b_gain & 0x1F);
94}
unsigned char u8
Definition stdint.h:131

References FL_NOEXCEPT.

Referenced by encodeHD108(), and encodeHD108_HD().

+ Here is the caller graph for this function: