diff options
Diffstat (limited to 'quantum/led_matrix')
12 files changed, 124 insertions, 118 deletions
| diff --git a/quantum/led_matrix/animations/alpha_mods_anim.h b/quantum/led_matrix/animations/alpha_mods_anim.h index 14038cd082..c82b2aa388 100644 --- a/quantum/led_matrix/animations/alpha_mods_anim.h +++ b/quantum/led_matrix/animations/alpha_mods_anim.h @@ -17,7 +17,7 @@ bool ALPHAS_MODS(effect_params_t* params) {              led_matrix_set_value(i, val1);          }      } -    return led_max < DRIVER_LED_TOTAL; +    return led_matrix_check_finished_leds(led_max);  }  #    endif  // LED_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/led_matrix/animations/breathing_anim.h b/quantum/led_matrix/animations/breathing_anim.h index e3f600c45c..d9cc2de23b 100644 --- a/quantum/led_matrix/animations/breathing_anim.h +++ b/quantum/led_matrix/animations/breathing_anim.h @@ -12,7 +12,7 @@ bool BREATHING(effect_params_t* params) {          LED_MATRIX_TEST_LED_FLAGS();          led_matrix_set_value(i, val);      } -    return led_max < DRIVER_LED_TOTAL; +    return led_matrix_check_finished_leds(led_max);  }  #    endif  // LED_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/led_matrix/animations/runners/effect_runner_dx_dy.h b/quantum/led_matrix/animations/runners/effect_runner_dx_dy.h index ef97631b90..fa9b7dbbfa 100644 --- a/quantum/led_matrix/animations/runners/effect_runner_dx_dy.h +++ b/quantum/led_matrix/animations/runners/effect_runner_dx_dy.h @@ -12,5 +12,5 @@ bool effect_runner_dx_dy(effect_params_t* params, dx_dy_f effect_func) {          int16_t dy = g_led_config.point[i].y - k_led_matrix_center.y;          led_matrix_set_value(i, effect_func(led_matrix_eeconfig.val, dx, dy, time));      } -    return led_max < DRIVER_LED_TOTAL; +    return led_matrix_check_finished_leds(led_max);  } diff --git a/quantum/led_matrix/animations/runners/effect_runner_dx_dy_dist.h b/quantum/led_matrix/animations/runners/effect_runner_dx_dy_dist.h index 5ef5938be0..061a5f07fe 100644 --- a/quantum/led_matrix/animations/runners/effect_runner_dx_dy_dist.h +++ b/quantum/led_matrix/animations/runners/effect_runner_dx_dy_dist.h @@ -13,5 +13,5 @@ bool effect_runner_dx_dy_dist(effect_params_t* params, dx_dy_dist_f effect_func)          uint8_t dist = sqrt16(dx * dx + dy * dy);          led_matrix_set_value(i, effect_func(led_matrix_eeconfig.val, dx, dy, dist, time));      } -    return led_max < DRIVER_LED_TOTAL; +    return led_matrix_check_finished_leds(led_max);  } diff --git a/quantum/led_matrix/animations/runners/effect_runner_i.h b/quantum/led_matrix/animations/runners/effect_runner_i.h index b3015759be..f6f8c0dee0 100644 --- a/quantum/led_matrix/animations/runners/effect_runner_i.h +++ b/quantum/led_matrix/animations/runners/effect_runner_i.h @@ -10,5 +10,5 @@ bool effect_runner_i(effect_params_t* params, i_f effect_func) {          LED_MATRIX_TEST_LED_FLAGS();          led_matrix_set_value(i, effect_func(led_matrix_eeconfig.val, i, time));      } -    return led_max < DRIVER_LED_TOTAL; +    return led_matrix_check_finished_leds(led_max);  } diff --git a/quantum/led_matrix/animations/runners/effect_runner_reactive.h b/quantum/led_matrix/animations/runners/effect_runner_reactive.h index 4369ea8c49..be3090aa53 100644 --- a/quantum/led_matrix/animations/runners/effect_runner_reactive.h +++ b/quantum/led_matrix/animations/runners/effect_runner_reactive.h @@ -22,7 +22,7 @@ bool effect_runner_reactive(effect_params_t* params, reactive_f effect_func) {          uint16_t offset = scale16by8(tick, led_matrix_eeconfig.speed);          led_matrix_set_value(i, effect_func(led_matrix_eeconfig.val, offset));      } -    return led_max < DRIVER_LED_TOTAL; +    return led_matrix_check_finished_leds(led_max);  }  #endif  // LED_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/led_matrix/animations/runners/effect_runner_reactive_splash.h b/quantum/led_matrix/animations/runners/effect_runner_reactive_splash.h index d6eb9731ee..f6ffc825a1 100644 --- a/quantum/led_matrix/animations/runners/effect_runner_reactive_splash.h +++ b/quantum/led_matrix/animations/runners/effect_runner_reactive_splash.h @@ -20,7 +20,7 @@ bool effect_runner_reactive_splash(uint8_t start, effect_params_t* params, react          }          led_matrix_set_value(i, scale8(val, led_matrix_eeconfig.val));      } -    return led_max < DRIVER_LED_TOTAL; +    return led_matrix_check_finished_leds(led_max);  }  #endif  // LED_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/led_matrix/animations/runners/effect_runner_sin_cos_i.h b/quantum/led_matrix/animations/runners/effect_runner_sin_cos_i.h index 4a5219abd1..3145e27139 100644 --- a/quantum/led_matrix/animations/runners/effect_runner_sin_cos_i.h +++ b/quantum/led_matrix/animations/runners/effect_runner_sin_cos_i.h @@ -12,5 +12,5 @@ bool effect_runner_sin_cos_i(effect_params_t* params, sin_cos_i_f effect_func) {          LED_MATRIX_TEST_LED_FLAGS();          led_matrix_set_value(i, effect_func(led_matrix_eeconfig.val, cos_value, sin_value, i, time));      } -    return led_max < DRIVER_LED_TOTAL; +    return led_matrix_check_finished_leds(led_max);  } diff --git a/quantum/led_matrix/animations/solid_anim.h b/quantum/led_matrix/animations/solid_anim.h index 4c9e43c581..c728dbcc98 100644 --- a/quantum/led_matrix/animations/solid_anim.h +++ b/quantum/led_matrix/animations/solid_anim.h @@ -9,7 +9,7 @@ bool SOLID(effect_params_t* params) {          LED_MATRIX_TEST_LED_FLAGS();          led_matrix_set_value(i, val);      } -    return led_max < DRIVER_LED_TOTAL; +    return led_matrix_check_finished_leds(led_max);  }  #endif  // LED_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/led_matrix/led_matrix.c b/quantum/led_matrix/led_matrix.c index 50510e49aa..8d6a56f27f 100644 --- a/quantum/led_matrix/led_matrix.c +++ b/quantum/led_matrix/led_matrix.c @@ -33,14 +33,6 @@ const led_point_t k_led_matrix_center = {112, 32};  const led_point_t k_led_matrix_center = LED_MATRIX_CENTER;  #endif -// clang-format off -#ifndef LED_MATRIX_IMMEDIATE_EEPROM -#    define led_eeconfig_update(v) led_update_eeprom |= v -#else -#    define led_eeconfig_update(v) if (v) eeconfig_update_led_matrix() -#endif -// clang-format on -  // Generic effect runners  #include "led_matrix_runners.inc" @@ -107,7 +99,6 @@ last_hit_t g_last_hit_tracker;  // internals  static bool            suspend_state     = false; -static bool            led_update_eeprom = false;  static uint8_t         led_last_enable   = UINT8_MAX;  static uint8_t         led_last_effect   = UINT8_MAX;  static effect_params_t led_effect_params = {0, LED_FLAG_ALL, false}; @@ -127,9 +118,9 @@ static last_hit_t last_hit_buffer;  const uint8_t k_led_matrix_split[2] = LED_MATRIX_SPLIT;  #endif -void eeconfig_read_led_matrix(void) { eeprom_read_block(&led_matrix_eeconfig, EECONFIG_LED_MATRIX, sizeof(led_matrix_eeconfig)); } +EECONFIG_DEBOUNCE_HELPER(led_matrix, EECONFIG_LED_MATRIX, led_matrix_eeconfig); -void eeconfig_update_led_matrix(void) { eeprom_update_block(&led_matrix_eeconfig, EECONFIG_LED_MATRIX, sizeof(led_matrix_eeconfig)); } +void eeconfig_update_led_matrix(void) { eeconfig_flush_led_matrix(true); }  void eeconfig_update_led_matrix_default(void) {      dprintf("eeconfig_update_led_matrix_default\n"); @@ -138,7 +129,7 @@ void eeconfig_update_led_matrix_default(void) {      led_matrix_eeconfig.val    = LED_MATRIX_STARTUP_VAL;      led_matrix_eeconfig.speed  = LED_MATRIX_STARTUP_SPD;      led_matrix_eeconfig.flags  = LED_FLAG_ALL; -    eeconfig_update_led_matrix(); +    eeconfig_flush_led_matrix(true);  }  void eeconfig_debug_led_matrix(void) { @@ -165,20 +156,10 @@ uint8_t led_matrix_map_row_column_to_led(uint8_t row, uint8_t column, uint8_t *l  void led_matrix_update_pwm_buffers(void) { led_matrix_driver.flush(); }  void led_matrix_set_value(int index, uint8_t value) { -#if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) -    if (!is_keyboard_left() && index >= k_led_matrix_split[0]) -#    ifdef USE_CIE1931_CURVE -        led_matrix_driver.set_value(index - k_led_matrix_split[0], pgm_read_byte(&CIE1931_CURVE[value])); -#    else -        led_matrix_driver.set_value(index - k_led_matrix_split[0], value); -#    endif -    else if (is_keyboard_left() && index < k_led_matrix_split[0]) -#endif  #ifdef USE_CIE1931_CURVE -        led_matrix_driver.set_value(index, pgm_read_byte(&CIE1931_CURVE[value])); -#else -    led_matrix_driver.set_value(index, value); +    value = pgm_read_byte(&CIE1931_CURVE[value]);  #endif +    led_matrix_driver.set_value(index, value);  }  void led_matrix_set_value_all(uint8_t value) { @@ -279,9 +260,8 @@ static void led_task_timers(void) {  }  static void led_task_sync(void) { +    eeconfig_flush_led_matrix(false);      // next task -    if (led_update_eeprom) eeconfig_update_led_matrix(); -    led_update_eeprom = false;      if (sync_timer_elapsed32(g_led_timer) >= LED_MATRIX_LED_FLUSH_LIMIT) led_task_state = STARTING;  } @@ -449,7 +429,7 @@ void led_matrix_init(void) {          eeconfig_update_led_matrix_default();      } -    eeconfig_read_led_matrix(); +    eeconfig_init_led_matrix();      if (!led_matrix_eeconfig.mode) {          dprintf("led_matrix_init_drivers led_matrix_eeconfig.mode = 0. Write default values to EEPROM.\n");          eeconfig_update_led_matrix_default(); @@ -472,7 +452,7 @@ bool led_matrix_get_suspend_state(void) { return suspend_state; }  void led_matrix_toggle_eeprom_helper(bool write_to_eeprom) {      led_matrix_eeconfig.enable ^= 1;      led_task_state = STARTING; -    led_eeconfig_update(write_to_eeprom); +    eeconfig_flag_led_matrix(write_to_eeprom);      dprintf("led matrix toggle [%s]: led_matrix_eeconfig.enable = %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", led_matrix_eeconfig.enable);  }  void led_matrix_toggle_noeeprom(void) { led_matrix_toggle_eeprom_helper(false); } @@ -480,7 +460,7 @@ void led_matrix_toggle(void) { led_matrix_toggle_eeprom_helper(true); }  void led_matrix_enable(void) {      led_matrix_enable_noeeprom(); -    led_eeconfig_update(true); +    eeconfig_flag_led_matrix(true);  }  void led_matrix_enable_noeeprom(void) { @@ -490,7 +470,7 @@ void led_matrix_enable_noeeprom(void) {  void led_matrix_disable(void) {      led_matrix_disable_noeeprom(); -    led_eeconfig_update(true); +    eeconfig_flag_led_matrix(true);  }  void led_matrix_disable_noeeprom(void) { @@ -512,7 +492,7 @@ void led_matrix_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom) {          led_matrix_eeconfig.mode = mode;      }      led_task_state = STARTING; -    led_eeconfig_update(write_to_eeprom); +    eeconfig_flag_led_matrix(write_to_eeprom);      dprintf("led matrix mode [%s]: %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", led_matrix_eeconfig.mode);  }  void led_matrix_mode_noeeprom(uint8_t mode) { led_matrix_mode_eeprom_helper(mode, false); } @@ -539,7 +519,7 @@ void led_matrix_set_val_eeprom_helper(uint8_t val, bool write_to_eeprom) {          return;      }      led_matrix_eeconfig.val = (val > LED_MATRIX_MAXIMUM_BRIGHTNESS) ? LED_MATRIX_MAXIMUM_BRIGHTNESS : val; -    led_eeconfig_update(write_to_eeprom); +    eeconfig_flag_led_matrix(write_to_eeprom);      dprintf("led matrix set val [%s]: %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", led_matrix_eeconfig.val);  }  void led_matrix_set_val_noeeprom(uint8_t val) { led_matrix_set_val_eeprom_helper(val, false); } @@ -557,7 +537,7 @@ void led_matrix_decrease_val(void) { led_matrix_decrease_val_helper(true); }  void led_matrix_set_speed_eeprom_helper(uint8_t speed, bool write_to_eeprom) {      led_matrix_eeconfig.speed = speed; -    led_eeconfig_update(write_to_eeprom); +    eeconfig_flag_led_matrix(write_to_eeprom);      dprintf("led matrix set speed [%s]: %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", led_matrix_eeconfig.speed);  }  void led_matrix_set_speed_noeeprom(uint8_t speed) { led_matrix_set_speed_eeprom_helper(speed, false); } diff --git a/quantum/led_matrix/led_matrix.h b/quantum/led_matrix/led_matrix.h index a7a1c983f7..5386744430 100644 --- a/quantum/led_matrix/led_matrix.h +++ b/quantum/led_matrix/led_matrix.h @@ -38,14 +38,33 @@  #endif  #if defined(LED_MATRIX_LED_PROCESS_LIMIT) && LED_MATRIX_LED_PROCESS_LIMIT > 0 && LED_MATRIX_LED_PROCESS_LIMIT < DRIVER_LED_TOTAL -#    define LED_MATRIX_USE_LIMITS(min, max)                        \ -        uint8_t min = LED_MATRIX_LED_PROCESS_LIMIT * params->iter; \ -        uint8_t max = min + LED_MATRIX_LED_PROCESS_LIMIT;          \ -        if (max > DRIVER_LED_TOTAL) max = DRIVER_LED_TOTAL; +#    if defined(LED_MATRIX_SPLIT) +#        define LED_MATRIX_USE_LIMITS(min, max)                                                   \ +            uint8_t min = LED_MATRIX_LED_PROCESS_LIMIT * params->iter;                            \ +            uint8_t max = min + LED_MATRIX_LED_PROCESS_LIMIT;                                     \ +            if (max > DRIVER_LED_TOTAL) max = DRIVER_LED_TOTAL;                                   \ +            uint8_t k_led_matrix_split[2] = LED_MATRIX_SPLIT;                                     \ +            if (is_keyboard_left() && (max > k_led_matrix_split[0])) max = k_led_matrix_split[0]; \ +            if (!(is_keyboard_left()) && (min < k_led_matrix_split[0])) min = k_led_matrix_split[0]; +#    else +#        define LED_MATRIX_USE_LIMITS(min, max)                        \ +            uint8_t min = LED_MATRIX_LED_PROCESS_LIMIT * params->iter; \ +            uint8_t max = min + LED_MATRIX_LED_PROCESS_LIMIT;          \ +            if (max > DRIVER_LED_TOTAL) max = DRIVER_LED_TOTAL; +#    endif  #else -#    define LED_MATRIX_USE_LIMITS(min, max) \ -        uint8_t min = 0;                    \ -        uint8_t max = DRIVER_LED_TOTAL; +#    if defined(LED_MATRIX_SPLIT) +#        define LED_MATRIX_USE_LIMITS(min, max)                                                   \ +            uint8_t       min                   = 0;                                              \ +            uint8_t       max                   = DRIVER_LED_TOTAL;                               \ +            const uint8_t k_led_matrix_split[2] = LED_MATRIX_SPLIT;                               \ +            if (is_keyboard_left() && (max > k_led_matrix_split[0])) max = k_led_matrix_split[0]; \ +            if (!(is_keyboard_left()) && (min < k_led_matrix_split[0])) min = k_led_matrix_split[0]; +#    else +#        define LED_MATRIX_USE_LIMITS(min, max) \ +            uint8_t min = 0;                    \ +            uint8_t max = DRIVER_LED_TOTAL; +#    endif  #endif  #define LED_MATRIX_TEST_LED_FLAGS() \ @@ -147,6 +166,18 @@ typedef struct {      void (*flush)(void);  } led_matrix_driver_t; +static inline bool led_matrix_check_finished_leds(uint8_t led_idx) { +#if defined(LED_MATRIX_SPLIT) +    if (is_keyboard_left()) { +        uint8_t k_led_matrix_split[2] = LED_MATRIX_SPLIT; +        return led_idx < k_led_matrix_split[0]; +    } else +        return led_idx < DRIVER_LED_TOTAL; +#else +    return led_idx < DRIVER_LED_TOTAL; +#endif +} +  extern const led_matrix_driver_t led_matrix_driver;  extern led_eeconfig_t led_matrix_eeconfig; diff --git a/quantum/led_matrix/led_matrix_drivers.c b/quantum/led_matrix/led_matrix_drivers.c index 1d46b2c506..2157619a0b 100644 --- a/quantum/led_matrix/led_matrix_drivers.c +++ b/quantum/led_matrix/led_matrix_drivers.c @@ -26,128 +26,123 @@   */  #if defined(IS31FL3731) || defined(IS31FL3733) -  #    include "i2c_master.h"  static void init(void) {      i2c_init(); -#    ifdef IS31FL3731 -#        ifdef LED_DRIVER_ADDR_1 + +#    if defined(IS31FL3731)      IS31FL3731_init(LED_DRIVER_ADDR_1); -#        endif -#        ifdef LED_DRIVER_ADDR_2 +#        if defined(LED_DRIVER_ADDR_2)      IS31FL3731_init(LED_DRIVER_ADDR_2); -#        endif -#        ifdef LED_DRIVER_ADDR_3 +#            if defined(LED_DRIVER_ADDR_3)      IS31FL3731_init(LED_DRIVER_ADDR_3); -#        endif -#        ifdef LED_DRIVER_ADDR_4 +#                if defined(LED_DRIVER_ADDR_4)      IS31FL3731_init(LED_DRIVER_ADDR_4); -#        endif -#    else -#        ifdef LED_DRIVER_ADDR_1 -#            ifndef LED_DRIVER_SYNC_1 -#                define LED_DRIVER_SYNC_1 0 +#                endif  #            endif -    IS31FL3733_init(LED_DRIVER_ADDR_1, LED_DRIVER_SYNC_1);  #        endif -#        ifdef LED_DRIVER_ADDR_2 -#            ifndef LED_DRIVER_SYNC_2 + +#    elif defined(IS31FL3733) +#        if !defined(LED_DRIVER_SYNC_1) +#            define LED_DRIVER_SYNC_1 0 +#        endif +    IS31FL3733_init(LED_DRIVER_ADDR_1, LED_DRIVER_SYNC_1); +#        if defined(LED_DRIVER_ADDR_2) +#            if !defined(LED_DRIVER_SYNC_2)  #                define LED_DRIVER_SYNC_2 0  #            endif      IS31FL3733_init(LED_DRIVER_ADDR_2, LED_DRIVER_SYNC_2); -#        endif -#        ifdef LED_DRIVER_ADDR_3 -#            ifndef LED_DRIVER_SYNC_3 -#                define LED_DRIVER_SYNC_3 0 -#            endif +#            if defined(LED_DRIVER_ADDR_3) +#                if !defined(LED_DRIVER_SYNC_3) +#                    define LED_DRIVER_SYNC_3 0 +#                endif      IS31FL3733_init(LED_DRIVER_ADDR_3, LED_DRIVER_SYNC_3); -#        endif -#        ifdef LED_DRIVER_ADDR_4 -#            ifndef LED_DRIVER_SYNC_4 -#                define LED_DRIVER_SYNC_4 0 -#            endif +#                if defined(LED_DRIVER_ADDR_4) +#                    if !defined(LED_DRIVER_SYNC_4) +#                        define LED_DRIVER_SYNC_4 0 +#                    endif      IS31FL3733_init(LED_DRIVER_ADDR_4, LED_DRIVER_SYNC_4); +#                endif +#            endif  #        endif  #    endif      for (int index = 0; index < DRIVER_LED_TOTAL; index++) { -#    ifdef IS31FL3731 +#    if defined(IS31FL3731)          IS31FL3731_set_led_control_register(index, true); -#    else +#    elif defined(IS31FL3733)          IS31FL3733_set_led_control_register(index, true);  #    endif      } +  // This actually updates the LED drivers -#    ifdef IS31FL3731 -#        ifdef LED_DRIVER_ADDR_1 +#    if defined(IS31FL3731)      IS31FL3731_update_led_control_registers(LED_DRIVER_ADDR_1, 0); -#        endif -#        ifdef LED_DRIVER_ADDR_2 +#        if defined(LED_DRIVER_ADDR_2)      IS31FL3731_update_led_control_registers(LED_DRIVER_ADDR_2, 1); -#        endif -#        ifdef LED_DRIVER_ADDR_3 +#            if defined(LED_DRIVER_ADDR_3)      IS31FL3731_update_led_control_registers(LED_DRIVER_ADDR_3, 2); -#        endif -#        ifdef LED_DRIVER_ADDR_4 +#                if defined(LED_DRIVER_ADDR_4)      IS31FL3731_update_led_control_registers(LED_DRIVER_ADDR_4, 3); +#                endif +#            endif  #        endif -#    else -#        ifdef LED_DRIVER_ADDR_1 + +#    elif defined(IS31FL3733)      IS31FL3733_update_led_control_registers(LED_DRIVER_ADDR_1, 0); -#        endif -#        ifdef LED_DRIVER_ADDR_2 +#        if defined(LED_DRIVER_ADDR_2)      IS31FL3733_update_led_control_registers(LED_DRIVER_ADDR_2, 1); -#        endif -#        ifdef LED_DRIVER_ADDR_3 +#            if defined(LED_DRIVER_ADDR_3)      IS31FL3733_update_led_control_registers(LED_DRIVER_ADDR_3, 2); -#        endif -#        ifdef LED_DRIVER_ADDR_4 +#                if defined(LED_DRIVER_ADDR_4)      IS31FL3733_update_led_control_registers(LED_DRIVER_ADDR_4, 3); +#                endif +#            endif  #        endif  #    endif  } +#    if defined(IS31FL3731)  static void flush(void) { -#    ifdef IS31FL3731 -#        ifdef LED_DRIVER_ADDR_1      IS31FL3731_update_pwm_buffers(LED_DRIVER_ADDR_1, 0); -#        endif -#        ifdef LED_DRIVER_ADDR_2 +#        if defined(LED_DRIVER_ADDR_2)      IS31FL3731_update_pwm_buffers(LED_DRIVER_ADDR_2, 1); -#        endif -#        ifdef LED_DRIVER_ADDR_3 +#            if defined(LED_DRIVER_ADDR_3)      IS31FL3731_update_pwm_buffers(LED_DRIVER_ADDR_3, 2); -#        endif -#        ifdef LED_DRIVER_ADDR_4 +#                if defined(LED_DRIVER_ADDR_4)      IS31FL3731_update_pwm_buffers(LED_DRIVER_ADDR_4, 3); +#                endif +#            endif  #        endif -#    else -#        ifdef LED_DRIVER_ADDR_1 +} + +const led_matrix_driver_t led_matrix_driver = { +    .init          = init, +    .flush         = flush, +    .set_value     = IS31FL3731_set_value, +    .set_value_all = IS31FL3731_set_value_all, +}; + +#    elif defined(IS31FL3733) +static void flush(void) {      IS31FL3733_update_pwm_buffers(LED_DRIVER_ADDR_1, 0); -#        endif -#        ifdef LED_DRIVER_ADDR_2 +#        if defined(LED_DRIVER_ADDR_2)      IS31FL3733_update_pwm_buffers(LED_DRIVER_ADDR_2, 1); -#        endif -#        ifdef LED_DRIVER_ADDR_3 +#            if defined(LED_DRIVER_ADDR_3)      IS31FL3733_update_pwm_buffers(LED_DRIVER_ADDR_3, 2); -#        endif -#        ifdef LED_DRIVER_ADDR_4 +#                if defined(LED_DRIVER_ADDR_4)      IS31FL3733_update_pwm_buffers(LED_DRIVER_ADDR_4, 3); +#                endif +#            endif  #        endif -#    endif  }  const led_matrix_driver_t led_matrix_driver = { -    .init  = init, +    .init = init,      .flush = flush, -#    ifdef IS31FL3731 -    .set_value     = IS31FL3731_set_value, -    .set_value_all = IS31FL3731_set_value_all, -#    else      .set_value = IS31FL3733_set_value,      .set_value_all = IS31FL3733_set_value_all, -#    endif  }; - +#    endif  #endif | 
