diff options
Diffstat (limited to 'quantum/led_matrix/led_matrix_drivers.c')
-rw-r--r-- | quantum/led_matrix/led_matrix_drivers.c | 223 |
1 files changed, 192 insertions, 31 deletions
diff --git a/quantum/led_matrix/led_matrix_drivers.c b/quantum/led_matrix/led_matrix_drivers.c index 13c8935d11..f52870aea5 100644 --- a/quantum/led_matrix/led_matrix_drivers.c +++ b/quantum/led_matrix/led_matrix_drivers.c @@ -25,13 +25,16 @@ * in their own files. */ -#if defined(IS31FL3731) || defined(IS31FL3733) || defined(IS31FLCOMMON) || defined(CKLED2001) +#if defined(LED_MATRIX_IS31FL3218) || defined(LED_MATRIX_IS31FL3731) || defined(LED_MATRIX_IS31FL3733) || defined(LED_MATRIX_IS31FL3736) || defined(LED_MATRIX_IS31FL3737) || defined(LED_MATRIX_IS31FL3741) || defined(IS31FLCOMMON) || defined(LED_MATRIX_SNLED27351) # include "i2c_master.h" static void init(void) { i2c_init(); -# if defined(IS31FL3731) +# if defined(LED_MATRIX_IS31FL3218) + is31fl3218_init(); + +# elif defined(LED_MATRIX_IS31FL3731) is31fl3731_init(LED_DRIVER_ADDR_1); # if defined(LED_DRIVER_ADDR_2) is31fl3731_init(LED_DRIVER_ADDR_2); @@ -43,7 +46,7 @@ static void init(void) { # endif # endif -# elif defined(IS31FL3733) +# elif defined(LED_MATRIX_IS31FL3733) # if !defined(LED_DRIVER_SYNC_1) # define LED_DRIVER_SYNC_1 0 # endif @@ -67,6 +70,42 @@ 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(LED_MATRIX_IS31FL3737) + is31fl3737_init(LED_DRIVER_ADDR_1); +# if defined(LED_DRIVER_ADDR_2) + is31fl3737_init(LED_DRIVER_ADDR_2); +# if defined(LED_DRIVER_ADDR_3) + is31fl3737_init(LED_DRIVER_ADDR_3); +# if defined(LED_DRIVER_ADDR_4) + is31fl3737_init(LED_DRIVER_ADDR_4); +# endif +# endif +# endif + +# elif defined(LED_MATRIX_IS31FL3741) + is31fl3741_init(LED_DRIVER_ADDR_1); +# if defined(LED_DRIVER_ADDR_2) + is31fl3741_init(LED_DRIVER_ADDR_2); +# if defined(LED_DRIVER_ADDR_3) + is31fl3741_init(LED_DRIVER_ADDR_3); +# if defined(LED_DRIVER_ADDR_4) + is31fl3741_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) @@ -78,38 +117,49 @@ static void init(void) { # endif # endif # endif -# elif defined(CKLED2001) +# elif defined(LED_MATRIX_SNLED27351) # if defined(LED_DRIVER_SHUTDOWN_PIN) setPinOutput(LED_DRIVER_SHUTDOWN_PIN); writePinHigh(LED_DRIVER_SHUTDOWN_PIN); # endif - ckled2001_init(DRIVER_ADDR_1); + snled27351_init(DRIVER_ADDR_1); # if defined(DRIVER_ADDR_2) - ckled2001_init(DRIVER_ADDR_2); + snled27351_init(DRIVER_ADDR_2); # if defined(DRIVER_ADDR_3) - ckled2001_init(DRIVER_ADDR_3); + snled27351_init(DRIVER_ADDR_3); # if defined(DRIVER_ADDR_4) - ckled2001_init(DRIVER_ADDR_4); + snled27351_init(DRIVER_ADDR_4); # endif # endif # endif # endif for (int index = 0; index < LED_MATRIX_LED_COUNT; index++) { -# if defined(IS31FL3731) +# if defined(LED_MATRIX_IS31FL3218) + is31fl3218_set_led_control_register(index, true); +# elif defined(LED_MATRIX_IS31FL3731) is31fl3731_set_led_control_register(index, true); -# elif defined(IS31FL3733) +# 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(LED_MATRIX_IS31FL3737) + is31fl3737_set_led_control_register(index, true); +# elif defined(LED_MATRIX_IS31FL3741) + is31fl3741_set_led_control_register(index, true); # elif defined(IS31FLCOMMON) IS31FL_simple_set_scaling_buffer(index, true); -# elif defined(CKLED2001) - ckled2001_set_led_control_register(index, true); +# elif defined(LED_MATRIX_SNLED27351) + snled27351_set_led_control_register(index, true); # endif } // This actually updates the LED drivers -# if defined(IS31FL3731) +# if defined(LED_MATRIX_IS31FL3218) + is31fl3218_update_led_control_registers(); + +# elif defined(LED_MATRIX_IS31FL3731) is31fl3731_update_led_control_registers(LED_DRIVER_ADDR_1, 0); # if defined(LED_DRIVER_ADDR_2) is31fl3731_update_led_control_registers(LED_DRIVER_ADDR_2, 1); @@ -121,7 +171,7 @@ static void init(void) { # endif # endif -# elif defined(IS31FL3733) +# elif defined(LED_MATRIX_IS31FL3733) is31fl3733_update_led_control_registers(LED_DRIVER_ADDR_1, 0); # if defined(LED_DRIVER_ADDR_2) is31fl3733_update_led_control_registers(LED_DRIVER_ADDR_2, 1); @@ -133,6 +183,42 @@ 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(LED_MATRIX_IS31FL3737) + is31fl3737_update_led_control_registers(LED_DRIVER_ADDR_1, 0); +# if defined(LED_DRIVER_ADDR_2) + is31fl3737_update_led_control_registers(LED_DRIVER_ADDR_2, 1); +# if defined(LED_DRIVER_ADDR_3) + is31fl3737_update_led_control_registers(LED_DRIVER_ADDR_3, 2); +# if defined(LED_DRIVER_ADDR_4) + is31fl3737_update_led_control_registers(LED_DRIVER_ADDR_4, 3); +# endif +# endif +# endif + +# elif defined(LED_MATRIX_IS31FL3741) + is31fl3741_update_led_control_registers(LED_DRIVER_ADDR_1, 0); +# if defined(LED_DRIVER_ADDR_2) + is31fl3741_update_led_control_registers(LED_DRIVER_ADDR_2, 1); +# if defined(LED_DRIVER_ADDR_3) + is31fl3741_update_led_control_registers(LED_DRIVER_ADDR_3, 2); +# if defined(LED_DRIVER_ADDR_4) + is31fl3741_update_led_control_registers(LED_DRIVER_ADDR_4, 3); +# endif +# endif +# endif + # elif defined(IS31FLCOMMON) # ifdef ISSI_MANUAL_SCALING IS31FL_set_manual_scaling_buffer(); @@ -147,21 +233,33 @@ static void init(void) { # endif # endif # endif -# elif defined(CKLED2001) - ckled2001_update_led_control_registers(DRIVER_ADDR_1, 0); +# elif defined(LED_MATRIX_SNLED27351) + snled27351_update_led_control_registers(DRIVER_ADDR_1, 0); # if defined(DRIVER_ADDR_2) - ckled2001_update_led_control_registers(DRIVER_ADDR_2, 1); + snled27351_update_led_control_registers(DRIVER_ADDR_2, 1); # if defined(DRIVER_ADDR_3) - ckled2001_update_led_control_registers(DRIVER_ADDR_3, 2); + snled27351_update_led_control_registers(DRIVER_ADDR_3, 2); # if defined(DRIVER_ADDR_4) - ckled2001_update_led_control_registers(DRIVER_ADDR_4, 3); + snled27351_update_led_control_registers(DRIVER_ADDR_4, 3); # endif # endif # endif # endif } -# if defined(IS31FL3731) +# if defined(LED_MATRIX_IS31FL3218) +static void flush(void) { + is31fl3218_update_pwm_buffers(); +} + +const led_matrix_driver_t led_matrix_driver = { + .init = init, + .flush = flush, + .set_value = is31fl3218_set_value, + .set_value_all = is31fl3218_set_value_all, +}; + +# elif defined(LED_MATRIX_IS31FL3731) static void flush(void) { is31fl3731_update_pwm_buffers(LED_DRIVER_ADDR_1, 0); # if defined(LED_DRIVER_ADDR_2) @@ -176,13 +274,13 @@ static void flush(void) { } const led_matrix_driver_t led_matrix_driver = { - .init = init, - .flush = flush, - .set_value = is31fl3731_set_value, + .init = init, + .flush = flush, + .set_value = is31fl3731_set_value, .set_value_all = is31fl3731_set_value_all, }; -# elif defined(IS31FL3733) +# elif defined(LED_MATRIX_IS31FL3733) static void flush(void) { is31fl3733_update_pwm_buffers(LED_DRIVER_ADDR_1, 0); # if defined(LED_DRIVER_ADDR_2) @@ -203,6 +301,69 @@ 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(LED_MATRIX_IS31FL3737) +static void flush(void) { + is31fl3737_update_pwm_buffers(LED_DRIVER_ADDR_1, 0); +# if defined(LED_DRIVER_ADDR_2) + is31fl3737_update_pwm_buffers(LED_DRIVER_ADDR_2, 1); +# if defined(LED_DRIVER_ADDR_3) + is31fl3737_update_pwm_buffers(LED_DRIVER_ADDR_3, 2); +# if defined(LED_DRIVER_ADDR_4) + is31fl3737_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 = is31fl3737_set_value, + .set_value_all = is31fl3737_set_value_all, +}; + +# elif defined(LED_MATRIX_IS31FL3741) +static void flush(void) { + is31fl3741_update_pwm_buffers(LED_DRIVER_ADDR_1, 0); +# if defined(LED_DRIVER_ADDR_2) + is31fl3741_update_pwm_buffers(LED_DRIVER_ADDR_2, 1); +# if defined(LED_DRIVER_ADDR_3) + is31fl3741_update_pwm_buffers(LED_DRIVER_ADDR_3, 2); +# if defined(LED_DRIVER_ADDR_4) + is31fl3741_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 = is31fl3741_set_value, + .set_value_all = is31fl3741_set_value_all, +}; + # elif defined(IS31FLCOMMON) static void flush(void) { IS31FL_common_update_pwm_register(DRIVER_ADDR_1, 0); @@ -223,15 +384,15 @@ const led_matrix_driver_t led_matrix_driver = { .set_value = IS31FL_simple_set_brightness, .set_value_all = IS31FL_simple_set_brigntness_all, }; -# elif defined(CKLED2001) +# elif defined(LED_MATRIX_SNLED27351) static void flush(void) { - ckled2001_update_pwm_buffers(DRIVER_ADDR_1, 0); + snled27351_update_pwm_buffers(DRIVER_ADDR_1, 0); # if defined(DRIVER_ADDR_2) - ckled2001_update_pwm_buffers(DRIVER_ADDR_2, 1); + snled27351_update_pwm_buffers(DRIVER_ADDR_2, 1); # if defined(DRIVER_ADDR_3) - ckled2001_update_pwm_buffers(DRIVER_ADDR_3, 2); + snled27351_update_pwm_buffers(DRIVER_ADDR_3, 2); # if defined(DRIVER_ADDR_4) - ckled2001_update_pwm_buffers(DRIVER_ADDR_4, 3); + snled27351_update_pwm_buffers(DRIVER_ADDR_4, 3); # endif # endif # endif @@ -240,8 +401,8 @@ static void flush(void) { const led_matrix_driver_t led_matrix_driver = { .init = init, .flush = flush, - .set_value = ckled2001_set_value, - .set_value_all = ckled2001_set_value_all, + .set_value = snled27351_set_value, + .set_value_all = snled27351_set_value_all, }; # endif #endif |