fix RGB setting

This commit is contained in:
King Kévin 2022-10-13 15:59:11 +02:00
parent fb2dda3fb3
commit 9fddbd4449
1 changed files with 13 additions and 0 deletions

13
main.c
View File

@ -159,6 +159,19 @@ void led_blue(uint16_t bightness)
TIM2->CCR1L.reg = (bightness >> 0); // set duty cycle
}
void led_rgb(uint8_t* rgb)
{
if (NULL == rgb) {
return;
}
led_red(rgb[0] << 8);
led_green(rgb[1] << 8);
led_blue(rgb[2] << 8);
// no idea why, but if I don't do it a second time the blue is a bit on when switched off
// it is not about the register order or preload
led_blue(rgb[2] << 8);
}
// configure timer to capture IR NEC codes
static void timer_ir_in(void)
{