summaryrefslogtreecommitdiffstats
path: root/quantum/led_matrix/led_matrix_drivers.c
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/led_matrix/led_matrix_drivers.c')
-rw-r--r--quantum/led_matrix/led_matrix_drivers.c94
1 files changed, 93 insertions, 1 deletions
diff --git a/quantum/led_matrix/led_matrix_drivers.c b/quantum/led_matrix/led_matrix_drivers.c
index 847ca1c310..7a6f3c5767 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) || defined(IS31FLCOMMON)
+#if defined(IS31FL3731) || defined(IS31FL3733) || defined(IS31FLCOMMON) || defined(CKLED2001)
# include "i2c_master.h"
static void init(void) {
@@ -78,6 +78,23 @@ static void init(void) {
# endif
# endif
# endif
+
+# elif defined(CKLED2001)
+# if defined(LED_DRIVER_SHUTDOWN_PIN)
+ setPinOutput(LED_DRIVER_SHUTDOWN_PIN);
+ writePinHigh(LED_DRIVER_SHUTDOWN_PIN);
+# endif
+
+ CKLED2001_init(DRIVER_ADDR_1);
+# if defined(DRIVER_ADDR_2)
+ CKLED2001_init(DRIVER_ADDR_2);
+# if defined(DRIVER_ADDR_3)
+ CKLED2001_init(DRIVER_ADDR_3);
+# if defined(DRIVER_ADDR_4)
+ CKLED2001_init(DRIVER_ADDR_4);
+# endif
+# endif
+# endif
# endif
for (int index = 0; index < DRIVER_LED_TOTAL; index++) {
@@ -87,6 +104,8 @@ static void init(void) {
IS31FL3733_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);
# endif
}
@@ -129,6 +148,18 @@ static void init(void) {
# endif
# endif
# endif
+
+# elif defined(CKLED2001)
+ CKLED2001_update_led_control_registers(DRIVER_ADDR_1, 0);
+# if defined(DRIVER_ADDR_2)
+ CKLED2001_update_led_control_registers(DRIVER_ADDR_2, 1);
+# if defined(DRIVER_ADDR_3)
+ CKLED2001_update_led_control_registers(DRIVER_ADDR_3, 2);
+# if defined(DRIVER_ADDR_4)
+ CKLED2001_update_led_control_registers(DRIVER_ADDR_4, 3);
+# endif
+# endif
+# endif
# endif
}
@@ -194,5 +225,66 @@ 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)
+static void flush(void) {
+ CKLED2001_update_pwm_buffers(DRIVER_ADDR_1, 0);
+# if defined(DRIVER_ADDR_2)
+ CKLED2001_update_pwm_buffers(DRIVER_ADDR_2, 1);
+# if defined(DRIVER_ADDR_3)
+ CKLED2001_update_pwm_buffers(DRIVER_ADDR_3, 2);
+# if defined(DRIVER_ADDR_4)
+ CKLED2001_update_pwm_buffers(DRIVER_ADDR_4, 3);
+# endif
+# endif
+# endif
+}
+
+# if defined(LED_MATRIX_DRIVER_SHUTDOWN_ENABLE)
+static void shutdown(void) {
+# if defined(LED_DRIVER_SHUTDOWN_PIN)
+ writePinLow(LED_DRIVER_SHUTDOWN_PIN);
+# else
+ CKLED2001_sw_shutdown(DRIVER_ADDR_1);
+# if defined(DRIVER_ADDR_2)
+ CKLED2001_sw_shutdown(DRIVER_ADDR_2);
+# if defined(DRIVER_ADDR_3)
+ CKLED2001_sw_shutdown(DRIVER_ADDR_3);
+# if defined(DRIVER_ADDR_4)
+ CKLED2001_sw_shutdown(DRIVER_ADDR_4);
+# endif
+# endif
+# endif
+# endif
+}
+
+static void exit_shutdown(void) {
+# if defined(LED_DRIVER_SHUTDOWN_PIN)
+ writePinHigh(LED_DRIVER_SHUTDOWN_PIN);
+# else
+ CKLED2001_sw_return_normal(DRIVER_ADDR_1);
+# if defined(DRIVER_ADDR_2)
+ CKLED2001_sw_return_normal(DRIVER_ADDR_2);
+# if defined(DRIVER_ADDR_3)
+ CKLED2001_sw_return_normal(DRIVER_ADDR_3);
+# if defined(DRIVER_ADDR_4)
+ CKLED2001_sw_return_normal(DRIVER_ADDR_4);
+# endif
+# endif
+# endif
+# endif
+}
+# endif
+
+const led_matrix_driver_t led_matrix_driver = {
+ .init = init,
+ .flush = flush,
+ .set_value = CKLED2001_set_value,
+ .set_value_all = CKLED2001_set_value_all,
+# if defined(LED_MATRIX_DRIVER_SHUTDOWN_ENABLE)
+ .shutdown = shutdown,
+ .exit_shutdown = exit_shutdown
+# endif
+};
# endif
#endif