From bdede8b2cdc05d5f3be04e900210aae9c07cf632 Mon Sep 17 00:00:00 2001 From: Ryan Date: Mon, 8 Jan 2024 12:24:10 +1100 Subject: LED drivers: misc formatting and typos (#22857) --- drivers/led/issi/is31fl3741.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'drivers/led/issi/is31fl3741.c') diff --git a/drivers/led/issi/is31fl3741.c b/drivers/led/issi/is31fl3741.c index 08b86f9171..9bc8c11e8c 100644 --- a/drivers/led/issi/is31fl3741.c +++ b/drivers/led/issi/is31fl3741.c @@ -185,12 +185,14 @@ void is31fl3741_init(uint8_t addr) { void is31fl3741_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { is31fl3741_led_t led; + if (index >= 0 && index < IS31FL3741_LED_COUNT) { memcpy_P(&led, (&g_is31fl3741_leds[index]), sizeof(led)); if (g_pwm_buffer[led.driver][led.r] == red && g_pwm_buffer[led.driver][led.g] == green && g_pwm_buffer[led.driver][led.b] == blue) { return; } + g_pwm_buffer_update_required[led.driver] = true; g_pwm_buffer[led.driver][led.r] = red; g_pwm_buffer[led.driver][led.g] = green; @@ -234,16 +236,15 @@ void is31fl3741_update_pwm_buffers(uint8_t addr, uint8_t index) { is31fl3741_select_page(addr, IS31FL3741_COMMAND_PWM_0); is31fl3741_write_pwm_buffer(addr, g_pwm_buffer[index]); - } - g_pwm_buffer_update_required[index] = false; + g_pwm_buffer_update_required[index] = false; + } } void is31fl3741_set_pwm_buffer(const is31fl3741_led_t *pled, uint8_t red, uint8_t green, uint8_t blue) { - g_pwm_buffer[pled->driver][pled->r] = red; - g_pwm_buffer[pled->driver][pled->g] = green; - g_pwm_buffer[pled->driver][pled->b] = blue; - + g_pwm_buffer[pled->driver][pled->r] = red; + g_pwm_buffer[pled->driver][pled->g] = green; + g_pwm_buffer[pled->driver][pled->b] = blue; g_pwm_buffer_update_required[pled->driver] = true; } @@ -268,10 +269,9 @@ void is31fl3741_update_led_control_registers(uint8_t addr, uint8_t index) { } void is31fl3741_set_scaling_registers(const is31fl3741_led_t *pled, uint8_t red, uint8_t green, uint8_t blue) { - g_scaling_registers[pled->driver][pled->r] = red; - g_scaling_registers[pled->driver][pled->g] = green; - g_scaling_registers[pled->driver][pled->b] = blue; - + g_scaling_registers[pled->driver][pled->r] = red; + g_scaling_registers[pled->driver][pled->g] = green; + g_scaling_registers[pled->driver][pled->b] = blue; g_scaling_registers_update_required[pled->driver] = true; } -- cgit v1.2.3