From d9eae3ef033d3adce7da1ba3d57cc9480659deb0 Mon Sep 17 00:00:00 2001 From: MelGeek <65591833+melgeek001365@users.noreply.github.com> Date: Sat, 20 Jun 2020 12:49:15 +0800 Subject: Support IS31FL3741 and IS31FL3741A. (#9201) --- quantum/rgb_matrix.h | 2 ++ quantum/rgb_matrix_drivers.c | 27 ++++++++++++++++++++++----- 2 files changed, 24 insertions(+), 5 deletions(-) (limited to 'quantum') diff --git a/quantum/rgb_matrix.h b/quantum/rgb_matrix.h index d9ce391068..03e9e8572c 100644 --- a/quantum/rgb_matrix.h +++ b/quantum/rgb_matrix.h @@ -32,6 +32,8 @@ # include "is31fl3733.h" #elif defined(IS31FL3737) # include "is31fl3737.h" +#elif defined(IS31FL3741) +# include "is31fl3741.h" #elif defined(WS2812) # include "ws2812.h" #endif diff --git a/quantum/rgb_matrix_drivers.c b/quantum/rgb_matrix_drivers.c index ea41b0d396..204b6c551f 100644 --- a/quantum/rgb_matrix_drivers.c +++ b/quantum/rgb_matrix_drivers.c @@ -23,7 +23,7 @@ * be here if shared between boards. */ -#if defined(IS31FL3731) || defined(IS31FL3733) || defined(IS31FL3737) +#if defined(IS31FL3731) || defined(IS31FL3733) || defined(IS31FL3737) || defined(IS31FL3741) # include "i2c_master.h" @@ -34,8 +34,10 @@ static void init(void) { IS31FL3731_init(DRIVER_ADDR_2); # elif defined(IS31FL3733) IS31FL3733_init(DRIVER_ADDR_1, 0); -# else +# elif defined(IS31FL3737) IS31FL3737_init(DRIVER_ADDR_1); +# else + IS31FL3741_init(DRIVER_ADDR_1); # endif for (int index = 0; index < DRIVER_LED_TOTAL; index++) { bool enabled = true; @@ -44,8 +46,10 @@ 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); -# else +# elif defined(IS31FL3737) IS31FL3737_set_led_control_register(index, enabled, enabled, enabled); +# else + IS31FL3741_set_led_control_register(index, enabled, enabled, enabled); # endif } // This actually updates the LED drivers @@ -55,8 +59,10 @@ static void init(void) { # elif defined(IS31FL3733) IS31FL3733_update_led_control_registers(DRIVER_ADDR_1, 0); IS31FL3733_update_led_control_registers(DRIVER_ADDR_2, 1); -# else +# elif defined(IS31FL3737) IS31FL3737_update_led_control_registers(DRIVER_ADDR_1, DRIVER_ADDR_2); +# else + IS31FL3741_update_led_control_registers(DRIVER_ADDR_1, 0); # endif } @@ -84,7 +90,7 @@ const rgb_matrix_driver_t rgb_matrix_driver = { .set_color = IS31FL3733_set_color, .set_color_all = IS31FL3733_set_color_all, }; -# else +# elif defined(IS31FL3737) static void flush(void) { IS31FL3737_update_pwm_buffers(DRIVER_ADDR_1, DRIVER_ADDR_2); } const rgb_matrix_driver_t rgb_matrix_driver = { @@ -93,6 +99,17 @@ const rgb_matrix_driver_t rgb_matrix_driver = { .set_color = IS31FL3737_set_color, .set_color_all = IS31FL3737_set_color_all, }; +# else +static void flush(void) { + IS31FL3741_update_pwm_buffers(DRIVER_ADDR_1, DRIVER_ADDR_2); +} + +const rgb_matrix_driver_t rgb_matrix_driver = { + .init = init, + .flush = flush, + .set_color = IS31FL3741_set_color, + .set_color_all = IS31FL3741_set_color_all, +}; # endif #elif defined(WS2812) -- cgit v1.2.3