From 9fddbd444972a2d0ee519061033a03e7af768c40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?King=20K=C3=A9vin?= Date: Thu, 13 Oct 2022 15:59:11 +0200 Subject: [PATCH] fix RGB setting --- main.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/main.c b/main.c index 586a7a4..e254940 100644 --- a/main.c +++ b/main.c @@ -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) {