firmware/main: Use "lightness" terminology

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
This commit is contained in:
Sylvain Munaut 2023-03-19 19:41:05 +01:00
parent a14030f4a4
commit 4da1f456ad
1 changed files with 6 additions and 5 deletions

View File

@ -74,10 +74,11 @@ static volatile struct wb_led_ctrl * const led_regs = (void*)(LED_CTRL_BASE);
/* ------------------------------------------------------------------------ */
/* CIE luminosity */
/* CIE lightness vs luminance */
/* ------------------------------------------------------------------------ */
/* Maps every PWM [1-256] to a perceived luminosity value [0-65535] */
/* Maps every PWM [1-256] value (essentially luminance) to a
* perceived lightness value [0-65535] */
static const uint16_t cie[] = {
1156, 3468, 5703, 7651, 9253, 10628, 11843, 12938,
13938, 14863, 15724, 16533, 17295, 18018, 18705, 19362,
@ -113,9 +114,9 @@ static const uint16_t cie[] = {
64785, 64886, 64986, 65087, 65187, 65287, 65386, 65485,
};
/* Converts a requested luminosity value to PWM length */
/* Converts a requested lightness value to PWM length */
static uint16_t
cie_lum2pwm(uint16_t lum)
cie_light2pwm(uint16_t lum)
{
int min = 0;
int max = 256;
@ -265,7 +266,7 @@ _led_map(struct led_subframe *subframes, uint16_t *leds)
/* Convert all linear brightness to pwm times */
for (a=0, l=0; a<14; a++)
for (k=0; k<3; k++, l++)
pwm[l] = (cie_lum2pwm(leds[l]) * k_scale[k]) >> 8;
pwm[l] = (cie_light2pwm(leds[l]) * k_scale[k]) >> 8;
/* Attempt packing */
sf_l = 0; /* Low boundary */