From 0452ad94791c99572c88af3cd5489ef3c0f9970f Mon Sep 17 00:00:00 2001 From: MasterSpoon <84671859+MasterSpoon@users.noreply.github.com> Date: Mon, 7 Feb 2022 03:04:43 +1000 Subject: Add RGB matrix & LED Matrix support for IS31FL3742A, IS31FL3743A, IS31FL3745, IS31FL3746A (#14989) Co-authored-by: Xelus22 <17491233+Xelus22@users.noreply.github.com> --- quantum/led_matrix/led_matrix.h | 2 ++ quantum/led_matrix/led_matrix_drivers.c | 52 ++++++++++++++++++++++++++++++++- quantum/rgb_matrix/rgb_matrix.h | 2 ++ quantum/rgb_matrix/rgb_matrix_drivers.c | 52 ++++++++++++++++++++++++++++++++- 4 files changed, 106 insertions(+), 2 deletions(-) (limited to 'quantum') diff --git a/quantum/led_matrix/led_matrix.h b/quantum/led_matrix/led_matrix.h index cb7526d6e0..d21f36e295 100644 --- a/quantum/led_matrix/led_matrix.h +++ b/quantum/led_matrix/led_matrix.h @@ -27,6 +27,8 @@ #ifdef IS31FL3731 # include "is31fl3731-simple.h" +#elif defined(IS31FLCOMMON) +# include "is31flcommon.h" #endif #ifdef IS31FL3733 # include "is31fl3733-simple.h" diff --git a/quantum/led_matrix/led_matrix_drivers.c b/quantum/led_matrix/led_matrix_drivers.c index 2157619a0b..847ca1c310 100644 --- a/quantum/led_matrix/led_matrix_drivers.c +++ b/quantum/led_matrix/led_matrix_drivers.c @@ -25,7 +25,7 @@ * in their own files. */ -#if defined(IS31FL3731) || defined(IS31FL3733) +#if defined(IS31FL3731) || defined(IS31FL3733) || defined(IS31FLCOMMON) # include "i2c_master.h" static void init(void) { @@ -66,6 +66,18 @@ static void init(void) { # endif # endif # endif + +# elif defined(IS31FLCOMMON) + IS31FL_common_init(DRIVER_ADDR_1, ISSI_SSR_1); +# if defined(LED_DRIVER_ADDR_2) + IS31FL_common_init(DRIVER_ADDR_2, ISSI_SSR_2); +# if defined(LED_DRIVER_ADDR_3) + IS31FL_common_init(DRIVER_ADDR_3, ISSI_SSR_3); +# if defined(LED_DRIVER_ADDR_4) + IS31FL_common_init(DRIVER_ADDR_4, ISSI_SSR_4); +# endif +# endif +# endif # endif for (int index = 0; index < DRIVER_LED_TOTAL; index++) { @@ -73,6 +85,8 @@ static void init(void) { IS31FL3731_set_led_control_register(index, true); # elif defined(IS31FL3733) IS31FL3733_set_led_control_register(index, true); +# elif defined(IS31FLCOMMON) + IS31FL_simple_set_scaling_buffer(index, true); # endif } @@ -100,6 +114,21 @@ static void init(void) { # endif # endif # endif + +# elif defined(IS31FLCOMMON) +# ifdef ISSI_MANUAL_SCALING + IS31FL_set_manual_scaling_buffer(); +# endif + IS31FL_common_update_scaling_register(DRIVER_ADDR_1, 0); +# if defined(LED_DRIVER_ADDR_2) + IS31FL_common_update_scaling_register(DRIVER_ADDR_2, 1); +# if defined(LED_DRIVER_ADDR_3) + IS31FL_common_update_scaling_register(DRIVER_ADDR_3, 2); +# if defined(LED_DRIVER_ADDR_4) + IS31FL_common_update_scaling_register(DRIVER_ADDR_4, 3); +# endif +# endif +# endif # endif } @@ -144,5 +173,26 @@ const led_matrix_driver_t led_matrix_driver = { .set_value = IS31FL3733_set_value, .set_value_all = IS31FL3733_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, + .set_value = IS31FL_simple_set_brightness, + .set_value_all = IS31FL_simple_set_brigntness_all, +}; # endif #endif diff --git a/quantum/rgb_matrix/rgb_matrix.h b/quantum/rgb_matrix/rgb_matrix.h index 3cd77857be..359d507a4d 100644 --- a/quantum/rgb_matrix/rgb_matrix.h +++ b/quantum/rgb_matrix/rgb_matrix.h @@ -32,6 +32,8 @@ # include "is31fl3737.h" #elif defined(IS31FL3741) # include "is31fl3741.h" +#elif defined(IS31FLCOMMON) +# include "is31flcommon.h" #elif defined(CKLED2001) # include "ckled2001.h" #elif defined(AW20216) diff --git a/quantum/rgb_matrix/rgb_matrix_drivers.c b/quantum/rgb_matrix/rgb_matrix_drivers.c index 130ca47a63..bdd512d1c2 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(CKLED2001) +#if defined(IS31FL3731) || defined(IS31FL3733) || defined(IS31FL3737) || defined(IS31FL3741) || defined(IS31FLCOMMON) || defined(CKLED2001) # include "i2c_master.h" // TODO: Remove this at some later date @@ -81,6 +81,18 @@ static void init(void) { # elif defined(IS31FL3741) IS31FL3741_init(DRIVER_ADDR_1); +# elif defined(IS31FLCOMMON) + IS31FL_common_init(DRIVER_ADDR_1, ISSI_SSR_1); +# if defined(DRIVER_ADDR_2) + IS31FL_common_init(DRIVER_ADDR_2, ISSI_SSR_2); +# if defined(DRIVER_ADDR_3) + IS31FL_common_init(DRIVER_ADDR_3, ISSI_SSR_3); +# if defined(DRIVER_ADDR_4) + IS31FL_common_init(DRIVER_ADDR_4, ISSI_SSR_4); +# endif +# endif +# endif + # elif defined(CKLED2001) CKLED2001_init(DRIVER_ADDR_1); # if defined(DRIVER_ADDR_2) @@ -106,6 +118,8 @@ static void init(void) { IS31FL3737_set_led_control_register(index, enabled, enabled, enabled); # elif defined(IS31FL3741) IS31FL3741_set_led_control_register(index, enabled, enabled, enabled); +# elif defined(IS31FLCOMMON) + IS31FL_RGB_set_scaling_buffer(index, enabled, enabled, enabled); # elif defined(CKLED2001) CKLED2001_set_led_control_register(index, enabled, enabled, enabled); # endif @@ -145,6 +159,21 @@ static void init(void) { # elif defined(IS31FL3741) IS31FL3741_update_led_control_registers(DRIVER_ADDR_1, 0); +# elif defined(IS31FLCOMMON) +# ifdef ISSI_MANUAL_SCALING + IS31FL_set_manual_scaling_buffer(); +# endif + IS31FL_common_update_scaling_register(DRIVER_ADDR_1, 0); +# if defined(DRIVER_ADDR_2) + IS31FL_common_update_scaling_register(DRIVER_ADDR_2, 1); +# if defined(DRIVER_ADDR_3) + IS31FL_common_update_scaling_register(DRIVER_ADDR_3, 2); +# if defined(DRIVER_ADDR_4) + IS31FL_common_update_scaling_register(DRIVER_ADDR_4, 3); +# endif +# endif +# endif + # elif defined(CKLED2001) CKLED2001_update_led_control_registers(DRIVER_ADDR_1, 0); # if defined(DRIVER_ADDR_2) @@ -231,6 +260,27 @@ const rgb_matrix_driver_t rgb_matrix_driver = { .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, + .set_color = IS31FL_RGB_set_color, + .set_color_all = IS31FL_RGB_set_color_all, +}; + # elif defined(CKLED2001) static void flush(void) { CKLED2001_update_pwm_buffers(DRIVER_ADDR_1, 0); -- cgit v1.2.3