@brief Generate HD108 per-channel gain header bytes @param brightness_8bit 8-bit brightness (0-255) - UNUSED, kept for API compatibility @param f0_out Output: first header byte @param f1_out Output: second header byte @note HD108 uses per-channel gain encoding: 5 bits each for R/G/B @note All gains set to maximum (31) for maximum precision @note Brightness control via 16-bit PWM values (applied be
| 78 | /// @note Brightness control via 16-bit PWM values (applied before encoding) |
| 79 | /// @note Future: Per channel gain control for higher color range |
| 80 | inline void hd108BrightnessHeader(u8 brightness_8bit, u8* f0_out, u8* f1_out) FL_NOEXCEPT { |
| 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 | } |
| 95 | |
| 96 | /// @brief Convert RGB to LPD6803 16-bit format (1bbbbbgggggrrrrr) |
| 97 | /// @param r Red component (0-255) |
no outgoing calls
no test coverage detected