Merge remote-tracking branch 'origin/master' into develop

master
QMK Bot 2020-12-06 06:18:31 +00:00
commit 7043561459
1 changed files with 9 additions and 8 deletions

View File

@ -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;
}
}