diff options
author | Donald Kjer <don.kjer@gmail.com> | 2021-05-21 21:42:39 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-21 21:42:39 -0700 |
commit | 8e96c5a060896c4aa5ed181d9c86c4e66bb78cfc (patch) | |
tree | 0c8b2755864b76654441258a2892a592db655a88 /quantum | |
parent | 81821f0a1207ffa0b533a09e6ac34c068b23fe49 (diff) |
Add support for up to 4 IS31FL3733 drivers (#12342)
Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>
Diffstat (limited to 'quantum')
-rw-r--r-- | quantum/led_matrix_drivers.c | 22 | ||||
-rw-r--r-- | quantum/rgb_matrix_drivers.c | 45 |
2 files changed, 58 insertions, 9 deletions
diff --git a/quantum/led_matrix_drivers.c b/quantum/led_matrix_drivers.c index 370c5e6853..f3d4bc896e 100644 --- a/quantum/led_matrix_drivers.c +++ b/quantum/led_matrix_drivers.c @@ -46,16 +46,28 @@ static void init(void) { # endif # else # ifdef LED_DRIVER_ADDR_1 - IS31FL3733_init(LED_DRIVER_ADDR_1, 0); +# ifndef LED_DRIVER_SYNC_1 +# define LED_DRIVER_SYNC_1 0 +# endif + IS31FL3733_init(LED_DRIVER_ADDR_1, LED_DRIVER_SYNC_1); # endif # ifdef LED_DRIVER_ADDR_2 - IS31FL3733_init(LED_DRIVER_ADDR_2, 0); +# ifndef 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 - IS31FL3733_init(LED_DRIVER_ADDR_3, 0); +# ifndef 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 - IS31FL3733_init(LED_DRIVER_ADDR_4, 0); +# ifndef LED_DRIVER_SYNC_4 +# define LED_DRIVER_SYNC_4 0 +# endif + IS31FL3733_init(LED_DRIVER_ADDR_4, LED_DRIVER_SYNC_4); # endif # endif @@ -133,7 +145,7 @@ const led_matrix_driver_t led_matrix_driver = { .set_value = IS31FL3731_set_value, .set_value_all = IS31FL3731_set_value_all, # else - .set_value = IS31FL3733_set_value, + .set_value = IS31FL3733_set_value, .set_value_all = IS31FL3733_set_value_all, # endif }; diff --git a/quantum/rgb_matrix_drivers.c b/quantum/rgb_matrix_drivers.c index 2978e7bed9..a4db86d196 100644 --- a/quantum/rgb_matrix_drivers.c +++ b/quantum/rgb_matrix_drivers.c @@ -41,7 +41,28 @@ static void init(void) { IS31FL3731_init(DRIVER_ADDR_4); # endif # elif defined(IS31FL3733) - IS31FL3733_init(DRIVER_ADDR_1, 0); +# ifndef DRIVER_SYNC_1 +# define DRIVER_SYNC_1 0 +# endif + IS31FL3733_init(DRIVER_ADDR_1, DRIVER_SYNC_1); +# if defined DRIVER_ADDR_2 && (DRIVER_ADDR_1 != DRIVER_ADDR_2) +# ifndef DRIVER_SYNC_2 +# define DRIVER_SYNC_2 0 +# endif + IS31FL3733_init(DRIVER_ADDR_2, DRIVER_SYNC_2); +# endif +# ifdef DRIVER_ADDR_3 +# ifndef DRIVER_SYNC_3 +# define DRIVER_SYNC_3 0 +# endif + IS31FL3733_init(DRIVER_ADDR_3, DRIVER_SYNC_3); +# endif +# ifdef DRIVER_ADDR_4 +# ifndef DRIVER_SYNC_4 +# define DRIVER_SYNC_4 0 +# endif + IS31FL3733_init(DRIVER_ADDR_4, DRIVER_SYNC_4); +# endif # elif defined(IS31FL3737) IS31FL3737_init(DRIVER_ADDR_1); # else @@ -74,7 +95,15 @@ static void init(void) { # endif # elif defined(IS31FL3733) IS31FL3733_update_led_control_registers(DRIVER_ADDR_1, 0); +# ifdef DRIVER_ADDR_2 IS31FL3733_update_led_control_registers(DRIVER_ADDR_2, 1); +# endif +# ifdef DRIVER_ADDR_3 + IS31FL3733_update_led_control_registers(DRIVER_ADDR_3, 2); +# endif +# ifdef DRIVER_ADDR_4 + IS31FL3733_update_led_control_registers(DRIVER_ADDR_4, 3); +# endif # elif defined(IS31FL3737) IS31FL3737_update_led_control_registers(DRIVER_ADDR_1, DRIVER_ADDR_2); # else @@ -105,13 +134,21 @@ const rgb_matrix_driver_t rgb_matrix_driver = { # elif defined(IS31FL3733) static void flush(void) { IS31FL3733_update_pwm_buffers(DRIVER_ADDR_1, 0); +# ifdef DRIVER_ADDR_2 IS31FL3733_update_pwm_buffers(DRIVER_ADDR_2, 1); +# endif +# ifdef DRIVER_ADDR_3 + IS31FL3733_update_pwm_buffers(DRIVER_ADDR_3, 2); +# endif +# ifdef DRIVER_ADDR_4 + IS31FL3733_update_pwm_buffers(DRIVER_ADDR_4, 3); +# endif } const rgb_matrix_driver_t rgb_matrix_driver = { - .init = init, - .flush = flush, - .set_color = IS31FL3733_set_color, + .init = init, + .flush = flush, + .set_color = IS31FL3733_set_color, .set_color_all = IS31FL3733_set_color_all, }; # elif defined(IS31FL3737) |