diff options
author | Ryan <fauxpark@gmail.com> | 2023-10-23 03:32:27 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-22 18:32:27 +0100 |
commit | cf7d3435d7e2cfb8927a1c436320f67bc9914eeb (patch) | |
tree | 272161a65714e8ba457d14af17a691becb7211ef /quantum | |
parent | 1e9b299fb0511e82ae60a4b39a1b277f4ea21afd (diff) |
Add `_flush()` functions to LED drivers (#22308)
Diffstat (limited to 'quantum')
-rw-r--r-- | quantum/led_matrix/led_matrix_drivers.c | 111 | ||||
-rw-r--r-- | quantum/rgb_matrix/rgb_matrix_drivers.c | 120 |
2 files changed, 17 insertions, 214 deletions
diff --git a/quantum/led_matrix/led_matrix_drivers.c b/quantum/led_matrix/led_matrix_drivers.c index 42594d2e16..ab8da3353a 100644 --- a/quantum/led_matrix/led_matrix_drivers.c +++ b/quantum/led_matrix/led_matrix_drivers.c @@ -249,159 +249,64 @@ static void init(void) { } # if defined(LED_MATRIX_IS31FL3218) -static void flush(void) { - is31fl3218_update_pwm_buffers(); -} - const led_matrix_driver_t led_matrix_driver = { .init = init, - .flush = flush, + .flush = is31fl3218_update_pwm_buffers, .set_value = is31fl3218_set_value, .set_value_all = is31fl3218_set_value_all, }; # elif defined(LED_MATRIX_IS31FL3731) -static void flush(void) { - is31fl3731_update_pwm_buffers(IS31FL3731_I2C_ADDRESS_1, 0); -# if defined(IS31FL3731_I2C_ADDRESS_2) - is31fl3731_update_pwm_buffers(IS31FL3731_I2C_ADDRESS_2, 1); -# if defined(IS31FL3731_I2C_ADDRESS_3) - is31fl3731_update_pwm_buffers(IS31FL3731_I2C_ADDRESS_3, 2); -# if defined(IS31FL3731_I2C_ADDRESS_4) - is31fl3731_update_pwm_buffers(IS31FL3731_I2C_ADDRESS_4, 3); -# endif -# endif -# endif -} - const led_matrix_driver_t led_matrix_driver = { .init = init, - .flush = flush, + .flush = is31fl3731_flush, .set_value = is31fl3731_set_value, .set_value_all = is31fl3731_set_value_all, }; # elif defined(LED_MATRIX_IS31FL3733) -static void flush(void) { - is31fl3733_update_pwm_buffers(IS31FL3733_I2C_ADDRESS_1, 0); -# if defined(IS31FL3733_I2C_ADDRESS_2) - is31fl3733_update_pwm_buffers(IS31FL3733_I2C_ADDRESS_2, 1); -# if defined(IS31FL3733_I2C_ADDRESS_3) - is31fl3733_update_pwm_buffers(IS31FL3733_I2C_ADDRESS_3, 2); -# if defined(IS31FL3733_I2C_ADDRESS_4) - is31fl3733_update_pwm_buffers(IS31FL3733_I2C_ADDRESS_4, 3); -# endif -# endif -# endif -} - const led_matrix_driver_t led_matrix_driver = { .init = init, - .flush = flush, + .flush = is31fl3733_flush, .set_value = is31fl3733_set_value, .set_value_all = is31fl3733_set_value_all, }; # elif defined(LED_MATRIX_IS31FL3736) -static void flush(void) { - is31fl3736_update_pwm_buffers(IS31FL3736_I2C_ADDRESS_1, 0); -# if defined(IS31FL3736_I2C_ADDRESS_2) - is31fl3736_update_pwm_buffers(IS31FL3736_I2C_ADDRESS_2, 1); -# if defined(IS31FL3736_I2C_ADDRESS_3) - is31fl3736_update_pwm_buffers(IS31FL3736_I2C_ADDRESS_3, 2); -# if defined(IS31FL3736_I2C_ADDRESS_4) - is31fl3736_update_pwm_buffers(IS31FL3736_I2C_ADDRESS_4, 3); -# endif -# endif -# endif -} - const led_matrix_driver_t led_matrix_driver = { .init = init, - .flush = flush, + .flush = is31fl3736_flush, .set_value = is31fl3736_set_value, .set_value_all = is31fl3736_set_value_all, }; # elif defined(LED_MATRIX_IS31FL3737) -static void flush(void) { - is31fl3737_update_pwm_buffers(IS31FL3737_I2C_ADDRESS_1, 0); -# if defined(IS31FL3737_I2C_ADDRESS_2) - is31fl3737_update_pwm_buffers(IS31FL3737_I2C_ADDRESS_2, 1); -# if defined(IS31FL3737_I2C_ADDRESS_3) - is31fl3737_update_pwm_buffers(IS31FL3737_I2C_ADDRESS_3, 2); -# if defined(IS31FL3737_I2C_ADDRESS_4) - is31fl3737_update_pwm_buffers(IS31FL3737_I2C_ADDRESS_4, 3); -# endif -# endif -# endif -} - const led_matrix_driver_t led_matrix_driver = { .init = init, - .flush = flush, + .flush = is31fl3737_flush, .set_value = is31fl3737_set_value, .set_value_all = is31fl3737_set_value_all, }; # elif defined(LED_MATRIX_IS31FL3741) -static void flush(void) { - is31fl3741_update_pwm_buffers(IS31FL3741_I2C_ADDRESS_1, 0); -# if defined(IS31FL3741_I2C_ADDRESS_2) - is31fl3741_update_pwm_buffers(IS31FL3741_I2C_ADDRESS_2, 1); -# if defined(IS31FL3741_I2C_ADDRESS_3) - is31fl3741_update_pwm_buffers(IS31FL3741_I2C_ADDRESS_3, 2); -# if defined(IS31FL3741_I2C_ADDRESS_4) - is31fl3741_update_pwm_buffers(IS31FL3741_I2C_ADDRESS_4, 3); -# endif -# endif -# endif -} - const led_matrix_driver_t led_matrix_driver = { .init = init, - .flush = flush, + .flush = is31fl3741_flush, .set_value = is31fl3741_set_value, .set_value_all = is31fl3741_set_value_all, }; # elif defined(IS31FLCOMMON) -static void flush(void) { - IS31FL_common_update_pwm_register(DRIVER_ADDR_1, 0); -# if defined(LED_DRIVER_ADDR_2) - IS31FL_common_update_pwm_register(DRIVER_ADDR_2, 1); -# if defined(LED_DRIVER_ADDR_3) - IS31FL_common_update_pwm_register(DRIVER_ADDR_3, 2); -# if defined(LED_DRIVER_ADDR_4) - IS31FL_common_update_pwm_register(DRIVER_ADDR_4, 3); -# endif -# endif -# endif -} - const led_matrix_driver_t led_matrix_driver = { .init = init, - .flush = flush, + .flush = IS31FL_common_flush, .set_value = IS31FL_simple_set_brightness, .set_value_all = IS31FL_simple_set_brigntness_all, }; # elif defined(LED_MATRIX_SNLED27351) -static void flush(void) { - snled27351_update_pwm_buffers(SNLED27351_I2C_ADDRESS_1, 0); -# if defined(SNLED27351_I2C_ADDRESS_2) - snled27351_update_pwm_buffers(SNLED27351_I2C_ADDRESS_2, 1); -# if defined(SNLED27351_I2C_ADDRESS_3) - snled27351_update_pwm_buffers(SNLED27351_I2C_ADDRESS_3, 2); -# if defined(SNLED27351_I2C_ADDRESS_4) - snled27351_update_pwm_buffers(SNLED27351_I2C_ADDRESS_4, 3); -# endif -# endif -# endif -} - const led_matrix_driver_t led_matrix_driver = { .init = init, - .flush = flush, + .flush = snled27351_flush, .set_value = snled27351_set_value, .set_value_all = snled27351_set_value_all, }; diff --git a/quantum/rgb_matrix/rgb_matrix_drivers.c b/quantum/rgb_matrix/rgb_matrix_drivers.c index 555e750e50..0fe93ee077 100644 --- a/quantum/rgb_matrix/rgb_matrix_drivers.c +++ b/quantum/rgb_matrix/rgb_matrix_drivers.c @@ -247,160 +247,65 @@ static void init(void) { } # if defined(RGB_MATRIX_IS31FL3218) -static void flush(void) { - is31fl3218_update_pwm_buffers(); -} - const rgb_matrix_driver_t rgb_matrix_driver = { .init = init, - .flush = flush, + .flush = is31fl3218_update_pwm_buffers, .set_color = is31fl3218_set_color, .set_color_all = is31fl3218_set_color_all, }; # elif defined(RGB_MATRIX_IS31FL3731) -static void flush(void) { - is31fl3731_update_pwm_buffers(IS31FL3731_I2C_ADDRESS_1, 0); -# if defined(IS31FL3731_I2C_ADDRESS_2) - is31fl3731_update_pwm_buffers(IS31FL3731_I2C_ADDRESS_2, 1); -# if defined(IS31FL3731_I2C_ADDRESS_3) - is31fl3731_update_pwm_buffers(IS31FL3731_I2C_ADDRESS_3, 2); -# if defined(IS31FL3731_I2C_ADDRESS_4) - is31fl3731_update_pwm_buffers(IS31FL3731_I2C_ADDRESS_4, 3); -# endif -# endif -# endif -} - const rgb_matrix_driver_t rgb_matrix_driver = { .init = init, - .flush = flush, + .flush = is31fl3731_flush, .set_color = is31fl3731_set_color, .set_color_all = is31fl3731_set_color_all, }; # elif defined(RGB_MATRIX_IS31FL3733) -static void flush(void) { - is31fl3733_update_pwm_buffers(IS31FL3733_I2C_ADDRESS_1, 0); -# if defined(IS31FL3733_I2C_ADDRESS_2) - is31fl3733_update_pwm_buffers(IS31FL3733_I2C_ADDRESS_2, 1); -# if defined(IS31FL3733_I2C_ADDRESS_3) - is31fl3733_update_pwm_buffers(IS31FL3733_I2C_ADDRESS_3, 2); -# if defined(IS31FL3733_I2C_ADDRESS_4) - is31fl3733_update_pwm_buffers(IS31FL3733_I2C_ADDRESS_4, 3); -# endif -# endif -# endif -} - const rgb_matrix_driver_t rgb_matrix_driver = { .init = init, - .flush = flush, + .flush = is31fl3733_flush, .set_color = is31fl3733_set_color, .set_color_all = is31fl3733_set_color_all, }; # elif defined(RGB_MATRIX_IS31FL3736) -static void flush(void) { - is31fl3736_update_pwm_buffers(IS31FL3736_I2C_ADDRESS_1, 0); -# if defined(IS31FL3736_I2C_ADDRESS_2) - is31fl3736_update_pwm_buffers(IS31FL3736_I2C_ADDRESS_2, 1); -# if defined(IS31FL3736_I2C_ADDRESS_3) - is31fl3736_update_pwm_buffers(IS31FL3736_I2C_ADDRESS_3, 2); -# if defined(IS31FL3736_I2C_ADDRESS_4) - is31fl3736_update_pwm_buffers(IS31FL3736_I2C_ADDRESS_4, 3); -# endif -# endif -# endif -} - const rgb_matrix_driver_t rgb_matrix_driver = { .init = init, - .flush = flush, + .flush = is31fl3736_flush, .set_color = is31fl3736_set_color, .set_color_all = is31fl3736_set_color_all, }; # elif defined(RGB_MATRIX_IS31FL3737) -static void flush(void) { - is31fl3737_update_pwm_buffers(IS31FL3737_I2C_ADDRESS_1, 0); -# if defined(IS31FL3737_I2C_ADDRESS_2) - is31fl3737_update_pwm_buffers(IS31FL3737_I2C_ADDRESS_2, 1); -# if defined(IS31FL3737_I2C_ADDRESS_3) - is31fl3737_update_pwm_buffers(IS31FL3737_I2C_ADDRESS_3, 2); -# if defined(IS31FL3737_I2C_ADDRESS_4) - is31fl3737_update_pwm_buffers(IS31FL3737_I2C_ADDRESS_4, 3); -# endif -# endif -# endif -} - const rgb_matrix_driver_t rgb_matrix_driver = { .init = init, - .flush = flush, + .flush = is31fl3737_flush, .set_color = is31fl3737_set_color, .set_color_all = is31fl3737_set_color_all, }; # elif defined(RGB_MATRIX_IS31FL3741) -static void flush(void) { - is31fl3741_update_pwm_buffers(IS31FL3741_I2C_ADDRESS_1, 0); -# if defined(IS31FL3741_I2C_ADDRESS_2) - is31fl3741_update_pwm_buffers(IS31FL3741_I2C_ADDRESS_2, 1); -# if defined(IS31FL3741_I2C_ADDRESS_3) - is31fl3741_update_pwm_buffers(IS31FL3741_I2C_ADDRESS_3, 2); -# if defined(IS31FL3741_I2C_ADDRESS_4) - is31fl3741_update_pwm_buffers(IS31FL3741_I2C_ADDRESS_4, 3); -# endif -# endif -# endif -} - const rgb_matrix_driver_t rgb_matrix_driver = { .init = init, - .flush = flush, + .flush = is31fl3741_flush, .set_color = is31fl3741_set_color, .set_color_all = is31fl3741_set_color_all, }; # elif defined(IS31FLCOMMON) -static void flush(void) { - IS31FL_common_update_pwm_register(DRIVER_ADDR_1, 0); -# if defined(DRIVER_ADDR_2) - IS31FL_common_update_pwm_register(DRIVER_ADDR_2, 1); -# if defined(DRIVER_ADDR_3) - IS31FL_common_update_pwm_register(DRIVER_ADDR_3, 2); -# if defined(DRIVER_ADDR_4) - IS31FL_common_update_pwm_register(DRIVER_ADDR_4, 3); -# endif -# endif -# endif -} - const rgb_matrix_driver_t rgb_matrix_driver = { .init = init, - .flush = flush, + .flush = IS31FL_common_flush, .set_color = IS31FL_RGB_set_color, .set_color_all = IS31FL_RGB_set_color_all, }; # elif defined(RGB_MATRIX_SNLED27351) -static void flush(void) { - snled27351_update_pwm_buffers(SNLED27351_I2C_ADDRESS_1, 0); -# if defined(SNLED27351_I2C_ADDRESS_2) - snled27351_update_pwm_buffers(SNLED27351_I2C_ADDRESS_2, 1); -# if defined(SNLED27351_I2C_ADDRESS_3) - snled27351_update_pwm_buffers(SNLED27351_I2C_ADDRESS_3, 2); -# if defined(SNLED27351_I2C_ADDRESS_4) - snled27351_update_pwm_buffers(SNLED27351_I2C_ADDRESS_4, 3); -# endif -# endif -# endif -} - const rgb_matrix_driver_t rgb_matrix_driver = { .init = init, - .flush = flush, + .flush = snled27351_flush, .set_color = snled27351_set_color, .set_color_all = snled27351_set_color_all, }; @@ -418,16 +323,9 @@ static void init(void) { # endif } -static void flush(void) { - aw20216s_update_pwm_buffers(AW20216S_CS_PIN_1, 0); -# if defined(AW20216S_CS_PIN_2) - aw20216s_update_pwm_buffers(AW20216S_CS_PIN_2, 1); -# endif -} - const rgb_matrix_driver_t rgb_matrix_driver = { .init = init, - .flush = flush, + .flush = aw20216s_flush, .set_color = aw20216s_set_color, .set_color_all = aw20216s_set_color_all, }; |