From 6a619e64037d54e04148e1ee7e1c170533d49236 Mon Sep 17 00:00:00 2001 From: Xelus22 <17491233+Xelus22@users.noreply.github.com> Date: Sun, 30 Apr 2023 12:35:27 +1000 Subject: [Core] Clean up ISSI drivers, Add IS31FL3736 support (#20572) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Pablo Martínez <58857054+elpekenin@users.noreply.github.com> --- quantum/rgb_matrix/rgb_matrix.h | 2 ++ quantum/rgb_matrix/rgb_matrix_drivers.c | 49 ++++++++++++++++++++++++++++++++- 2 files changed, 50 insertions(+), 1 deletion(-) (limited to 'quantum/rgb_matrix') diff --git a/quantum/rgb_matrix/rgb_matrix.h b/quantum/rgb_matrix/rgb_matrix.h index 6b373d0bcd..9ea248b66d 100644 --- a/quantum/rgb_matrix/rgb_matrix.h +++ b/quantum/rgb_matrix/rgb_matrix.h @@ -28,6 +28,8 @@ # include "is31fl3731.h" #elif defined(IS31FL3733) # include "is31fl3733.h" +#elif defined(IS31FL3736) +# include "is31fl3736.h" #elif defined(IS31FL3737) # include "is31fl3737.h" #elif defined(IS31FL3741) diff --git a/quantum/rgb_matrix/rgb_matrix_drivers.c b/quantum/rgb_matrix/rgb_matrix_drivers.c index 415c66f115..d65121baf4 100644 --- a/quantum/rgb_matrix/rgb_matrix_drivers.c +++ b/quantum/rgb_matrix/rgb_matrix_drivers.c @@ -23,7 +23,7 @@ * be here if shared between boards. */ -#if defined(IS31FL3731) || defined(IS31FL3733) || defined(IS31FL3737) || defined(IS31FL3741) || defined(IS31FLCOMMON) || defined(CKLED2001) +#if 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 @@ -72,6 +72,18 @@ static void init(void) { # endif # endif +# elif defined(IS31FL3736) + IS31FL3736_init(DRIVER_ADDR_1); +# if defined(DRIVER_ADDR_2) + IS31FL3736_init(DRIVER_ADDR_2); +# if defined(DRIVER_ADDR_3) + IS31FL3736_init(DRIVER_ADDR_3); +# if defined(DRIVER_ADDR_4) + IS31FL3736_init(DRIVER_ADDR_4); +# endif +# endif +# endif + # elif defined(IS31FL3737) IS31FL3737_init(DRIVER_ADDR_1); # if defined(DRIVER_ADDR_2) @@ -120,6 +132,8 @@ static void init(void) { IS31FL3731_set_led_control_register(index, enabled, enabled, enabled); # elif defined(IS31FL3733) IS31FL3733_set_led_control_register(index, enabled, enabled, enabled); +# elif defined(IS31FL3736) + IS31FL3736_set_led_control_register(index, enabled, enabled, enabled); # elif defined(IS31FL3737) IS31FL3737_set_led_control_register(index, enabled, enabled, enabled); # elif defined(IS31FL3741) @@ -156,6 +170,18 @@ static void init(void) { # endif # endif +# elif defined(IS31FL3736) + IS31FL3736_update_led_control_registers(DRIVER_ADDR_1, 0); +# if defined(DRIVER_ADDR_2) + IS31FL3736_update_led_control_registers(DRIVER_ADDR_2, 1); +# if defined(DRIVER_ADDR_3) + IS31FL3736_update_led_control_registers(DRIVER_ADDR_3, 2); +# if defined(DRIVER_ADDR_4) + IS31FL3736_update_led_control_registers(DRIVER_ADDR_4, 3); +# endif +# endif +# endif + # elif defined(IS31FL3737) IS31FL3737_update_led_control_registers(DRIVER_ADDR_1, 0); # if defined(DRIVER_ADDR_2) @@ -242,6 +268,27 @@ const rgb_matrix_driver_t rgb_matrix_driver = { .set_color_all = IS31FL3733_set_color_all, }; +# elif defined(IS31FL3736) +static void flush(void) { + IS31FL3736_update_pwm_buffers(DRIVER_ADDR_1, 0); +# if defined(DRIVER_ADDR_2) + IS31FL3736_update_pwm_buffers(DRIVER_ADDR_2, 1); +# if defined(DRIVER_ADDR_3) + IS31FL3736_update_pwm_buffers(DRIVER_ADDR_3, 2); +# if defined(DRIVER_ADDR_4) + IS31FL3736_update_pwm_buffers(DRIVER_ADDR_4, 3); +# endif +# endif +# endif +} + +const rgb_matrix_driver_t rgb_matrix_driver = { + .init = init, + .flush = flush, + .set_color = IS31FL3736_set_color, + .set_color_all = IS31FL3736_set_color_all, +}; + # elif defined(IS31FL3737) static void flush(void) { IS31FL3737_update_pwm_buffers(DRIVER_ADDR_1, 0); -- cgit v1.2.3