diff options
author | Ryan <fauxpark@gmail.com> | 2023-09-27 10:18:07 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-27 01:18:07 +0100 |
commit | 32de27bb20071e4e8614b0fd1f2d289e016ca5a1 (patch) | |
tree | df4394b3a03d8dc83ec9bdd57774453bccc74a99 /quantum/led_matrix | |
parent | 5da3604ec37fadbc737978d2d8ab77492da478eb (diff) |
is31fl3736: extract single-color API (#22133)
Diffstat (limited to 'quantum/led_matrix')
-rw-r--r-- | quantum/led_matrix/led_matrix.h | 8 | ||||
-rw-r--r-- | quantum/led_matrix/led_matrix_drivers.c | 49 |
2 files changed, 54 insertions, 3 deletions
diff --git a/quantum/led_matrix/led_matrix.h b/quantum/led_matrix/led_matrix.h index d654fd5757..2b41f11bbf 100644 --- a/quantum/led_matrix/led_matrix.h +++ b/quantum/led_matrix/led_matrix.h @@ -27,12 +27,16 @@ #ifdef LED_MATRIX_IS31FL3731 # include "is31fl3731-simple.h" -#elif defined(IS31FLCOMMON) -# include "is31flcommon.h" #endif #ifdef LED_MATRIX_IS31FL3733 # include "is31fl3733-simple.h" #endif +#ifdef LED_MATRIX_IS31FL3736 +# include "is31fl3736-simple.h" +#endif +#if defined(IS31FLCOMMON) +# include "is31flcommon.h" +#endif #ifdef LED_MATRIX_CKLED2001 # include "ckled2001-simple.h" #endif diff --git a/quantum/led_matrix/led_matrix_drivers.c b/quantum/led_matrix/led_matrix_drivers.c index 77c5aa3d0a..7ca0c7958f 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(LED_MATRIX_IS31FL3731) || defined(LED_MATRIX_IS31FL3733) || defined(IS31FLCOMMON) || defined(LED_MATRIX_CKLED2001) +#if defined(LED_MATRIX_IS31FL3731) || defined(LED_MATRIX_IS31FL3733) || defined(LED_MATRIX_IS31FL3736) || defined(IS31FLCOMMON) || defined(LED_MATRIX_CKLED2001) # include "i2c_master.h" static void init(void) { @@ -67,6 +67,18 @@ static void init(void) { # endif # endif +# elif defined(LED_MATRIX_IS31FL3736) + is31fl3736_init(LED_DRIVER_ADDR_1); +# if defined(LED_DRIVER_ADDR_2) + is31fl3736_init(LED_DRIVER_ADDR_2); +# if defined(LED_DRIVER_ADDR_3) + is31fl3736_init(LED_DRIVER_ADDR_3); +# if defined(LED_DRIVER_ADDR_4) + is31fl3736_init(LED_DRIVER_ADDR_4); +# endif +# endif +# endif + # elif defined(IS31FLCOMMON) IS31FL_common_init(DRIVER_ADDR_1, ISSI_SSR_1); # if defined(LED_DRIVER_ADDR_2) @@ -101,6 +113,8 @@ static void init(void) { is31fl3731_set_led_control_register(index, true); # elif defined(LED_MATRIX_IS31FL3733) is31fl3733_set_led_control_register(index, true); +# elif defined(LED_MATRIX_IS31FL3736) + is31fl3736_set_led_control_register(index, true); # elif defined(IS31FLCOMMON) IS31FL_simple_set_scaling_buffer(index, true); # elif defined(LED_MATRIX_CKLED2001) @@ -133,6 +147,18 @@ static void init(void) { # endif # endif +# elif defined(LED_MATRIX_IS31FL3736) + is31fl3736_update_led_control_registers(LED_DRIVER_ADDR_1, 0); +# if defined(LED_DRIVER_ADDR_2) + is31fl3736_update_led_control_registers(LED_DRIVER_ADDR_2, 1); +# if defined(LED_DRIVER_ADDR_3) + is31fl3736_update_led_control_registers(LED_DRIVER_ADDR_3, 2); +# if defined(LED_DRIVER_ADDR_4) + is31fl3736_update_led_control_registers(LED_DRIVER_ADDR_4, 3); +# endif +# endif +# endif + # elif defined(IS31FLCOMMON) # ifdef ISSI_MANUAL_SCALING IS31FL_set_manual_scaling_buffer(); @@ -203,6 +229,27 @@ const led_matrix_driver_t led_matrix_driver = { .set_value_all = is31fl3733_set_value_all, }; +# elif defined(LED_MATRIX_IS31FL3736) +static void flush(void) { + is31fl3736_update_pwm_buffers(LED_DRIVER_ADDR_1, 0); +# if defined(LED_DRIVER_ADDR_2) + is31fl3736_update_pwm_buffers(LED_DRIVER_ADDR_2, 1); +# if defined(LED_DRIVER_ADDR_3) + is31fl3736_update_pwm_buffers(LED_DRIVER_ADDR_3, 2); +# if defined(LED_DRIVER_ADDR_4) + is31fl3736_update_pwm_buffers(LED_DRIVER_ADDR_4, 3); +# endif +# endif +# endif +} + +const led_matrix_driver_t led_matrix_driver = { + .init = init, + .flush = flush, + .set_value = is31fl3736_set_value, + .set_value_all = is31fl3736_set_value_all, +}; + # elif defined(IS31FLCOMMON) static void flush(void) { IS31FL_common_update_pwm_register(DRIVER_ADDR_1, 0); |