FastLED 3.10.6
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. Callers advertising a working brightness parameter on top of this are advertising something that does not happen; see encodeHD108() (FastLED#4042).
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 83 of file encoder_utils.h.

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

References FL_NO_EXCEPT.

Referenced by encodeHD108(), encodeHD108_HD(), and fl::PixelIterator::writeHD108().

+ Here is the caller graph for this function: