From 6b1f96dca8b1218c0e3de6ef23dbde107f8c4588 Mon Sep 17 00:00:00 2001 From: Xelus22 <17491233+Xelus22@users.noreply.github.com> Date: Sun, 6 Dec 2020 06:18:02 +0000 Subject: [PATCH] Update is31fl3731-simple (#7610) * update simple * Update is31fl3731-simple.c --- drivers/issi/is31fl3731-simple.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/issi/is31fl3731-simple.c b/drivers/issi/is31fl3731-simple.c index bd3bb47460..cffb4d87ff 100644 --- a/drivers/issi/is31fl3731-simple.c +++ b/drivers/issi/is31fl3731-simple.c @@ -63,7 +63,7 @@ uint8_t g_twi_transfer_buffer[20]; // buffers and the transfers in IS31FL3731_write_pwm_buffer() but it's // probably not worth the extra complexity. uint8_t g_pwm_buffer[LED_DRIVER_COUNT][144]; -bool g_pwm_buffer_update_required = false; +bool g_pwm_buffer_update_required[LED_DRIVER_COUNT] = {false}; /* There's probably a better way to init this... */ #if LED_DRIVER_COUNT == 1 @@ -75,7 +75,7 @@ uint8_t g_led_control_registers[LED_DRIVER_COUNT][18] = {{0}, {0}, {0}}; #elif LED_DRIVER_COUNT == 4 uint8_t g_led_control_registers[LED_DRIVER_COUNT][18] = {{0}, {0}, {0}, {0}}; #endif -bool g_led_control_registers_update_required = false; +bool g_led_control_registers_update_required[LED_DRIVER_COUNT] = {false}; // This is the bit pattern in the LED control registers // (for matrix A, add one to register for matrix B) @@ -190,8 +190,8 @@ void IS31FL3731_set_value(int index, uint8_t value) { is31_led led = g_is31_leds[index]; // Subtract 0x24 to get the second index of g_pwm_buffer - g_pwm_buffer[led.driver][led.v - 0x24] = value; - g_pwm_buffer_update_required = true; + g_pwm_buffer[led.driver][led.v - 0x24] = value; + g_pwm_buffer_update_required[led.driver] = true; } } @@ -213,20 +213,21 @@ void IS31FL3731_set_led_control_register(uint8_t index, bool value) { g_led_control_registers[led.driver][control_register] &= ~(1 << bit_value); } - g_led_control_registers_update_required = true; + g_led_control_registers_update_required[led.driver] = true; } void IS31FL3731_update_pwm_buffers(uint8_t addr, uint8_t index) { - if (g_pwm_buffer_update_required) { + if (g_pwm_buffer_update_required[index]) { IS31FL3731_write_pwm_buffer(addr, g_pwm_buffer[index]); - g_pwm_buffer_update_required = false; + g_pwm_buffer_update_required[index] = false; } } void IS31FL3731_update_led_control_registers(uint8_t addr, uint8_t index) { - if (g_led_control_registers_update_required) { + if (g_led_control_registers_update_required[index]) { for (int i = 0; i < 18; i++) { IS31FL3731_write_register(addr, i, g_led_control_registers[index][i]); } + g_led_control_registers_update_required[index] = false; } }