From 1ea54a2d8da9e64e5a2c1fd882a13058523b50bc Mon Sep 17 00:00:00 2001 From: Ryan Date: Sun, 17 Sep 2023 22:11:16 +1000 Subject: Complete RGB Matrix support for IS31FL3218 (#22004) --- quantum/rgb_matrix/rgb_matrix.h | 4 +++- quantum/rgb_matrix/rgb_matrix_drivers.c | 36 +++++++++++++++++++++++++-------- 2 files changed, 31 insertions(+), 9 deletions(-) (limited to 'quantum/rgb_matrix') diff --git a/quantum/rgb_matrix/rgb_matrix.h b/quantum/rgb_matrix/rgb_matrix.h index ab5184fe18..377f6658bb 100644 --- a/quantum/rgb_matrix/rgb_matrix.h +++ b/quantum/rgb_matrix/rgb_matrix.h @@ -24,7 +24,9 @@ #include "color.h" #include "keyboard.h" -#ifdef IS31FL3731 +#if defined(IS31FL3218) +# include "is31fl3218.h" +#elif defined(IS31FL3731) # include "is31fl3731.h" #elif defined(IS31FL3733) # include "is31fl3733.h" diff --git a/quantum/rgb_matrix/rgb_matrix_drivers.c b/quantum/rgb_matrix/rgb_matrix_drivers.c index 67330434ed..a81edce180 100644 --- a/quantum/rgb_matrix/rgb_matrix_drivers.c +++ b/quantum/rgb_matrix/rgb_matrix_drivers.c @@ -24,7 +24,7 @@ * be here if shared between boards. */ -#if defined(IS31FL3731) || defined(IS31FL3733) || defined(IS31FL3736) || defined(IS31FL3737) || defined(IS31FL3741) || defined(IS31FLCOMMON) || defined(CKLED2001) +#if defined(IS31FL3218) || defined(IS31FL3731) || defined(IS31FL3733) || defined(IS31FL3736) || defined(IS31FL3737) || defined(IS31FL3741) || defined(IS31FLCOMMON) || defined(CKLED2001) # include "i2c_master.h" // TODO: Remove this at some later date @@ -37,7 +37,10 @@ static void init(void) { i2c_init(); -# if defined(IS31FL3731) +# if defined(IS31FL3218) + is31fl3218_init(); + +# elif defined(IS31FL3731) is31fl3731_init(DRIVER_ADDR_1); # if defined(DRIVER_ADDR_2) is31fl3731_init(DRIVER_ADDR_2); @@ -138,7 +141,9 @@ static void init(void) { bool enabled = true; // This only caches it for later -# if defined(IS31FL3731) +# if defined(IS31FL3218) + is31fl3218_set_led_control_register(index, enabled, enabled, enabled); +# elif defined(IS31FL3731) is31fl3731_set_led_control_register(index, enabled, enabled, enabled); # elif defined(IS31FL3733) is31fl3733_set_led_control_register(index, enabled, enabled, enabled); @@ -156,7 +161,10 @@ static void init(void) { } // This actually updates the LED drivers -# if defined(IS31FL3731) +# if defined(IS31FL3218) + is31fl3218_update_led_control_registers(); + +# elif defined(IS31FL3731) is31fl3731_update_led_control_registers(DRIVER_ADDR_1, 0); # if defined(DRIVER_ADDR_2) is31fl3731_update_led_control_registers(DRIVER_ADDR_2, 1); @@ -245,7 +253,19 @@ static void init(void) { # endif } -# if defined(IS31FL3731) +# if defined(IS31FL3218) +static void flush(void) { + is31fl3218_update_pwm_buffers(); +} + +const rgb_matrix_driver_t rgb_matrix_driver = { + .init = init, + .flush = flush, + .set_color = is31fl3218_set_color, + .set_color_all = is31fl3218_set_color_all, +}; + +# elif defined(IS31FL3731) static void flush(void) { is31fl3731_update_pwm_buffers(DRIVER_ADDR_1, 0); # if defined(DRIVER_ADDR_2) @@ -260,9 +280,9 @@ static void flush(void) { } const rgb_matrix_driver_t rgb_matrix_driver = { - .init = init, - .flush = flush, - .set_color = is31fl3731_set_color, + .init = init, + .flush = flush, + .set_color = is31fl3731_set_color, .set_color_all = is31fl3731_set_color_all, }; -- cgit v1.2.3