summaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
authorlokher <lokher@gmail.com>2022-08-13 21:39:06 +0800
committerGitHub <noreply@github.com>2022-08-13 14:39:06 +0100
commita02aff9c77c15ca9e248f84b09a88386a8f4b0a6 (patch)
treec37116d7c427cc40e61f87110f1f351b564e3676 /quantum
parentee664e0960f912876c19675b61219985abb11d0e (diff)
downloadqmk_firmware-a02aff9c77c15ca9e248f84b09a88386a8f4b0a6.tar.gz
qmk_firmware-a02aff9c77c15ca9e248f84b09a88386a8f4b0a6.zip
Add led matrix support for CKLED2001 (#17643)
Diffstat (limited to 'quantum')
-rw-r--r--quantum/led_matrix/led_matrix.h3
-rw-r--r--quantum/led_matrix/led_matrix_drivers.c51
2 files changed, 53 insertions, 1 deletions
diff --git a/quantum/led_matrix/led_matrix.h b/quantum/led_matrix/led_matrix.h
index b2abec7eb1..446f293c78 100644
--- a/quantum/led_matrix/led_matrix.h
+++ b/quantum/led_matrix/led_matrix.h
@@ -33,6 +33,9 @@
#ifdef IS31FL3733
# include "is31fl3733-simple.h"
#endif
+#ifdef CKLED2001
+# include "ckled2001-simple.h"
+#endif
#ifndef LED_MATRIX_LED_FLUSH_LIMIT
# define LED_MATRIX_LED_FLUSH_LIMIT 16
diff --git a/quantum/led_matrix/led_matrix_drivers.c b/quantum/led_matrix/led_matrix_drivers.c
index 847ca1c310..f01b395c15 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,22 @@ 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 +103,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 +147,17 @@ 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 +223,25 @@ 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
+}
+
+const led_matrix_driver_t led_matrix_driver = {
+ .init = init,
+ .flush = flush,
+ .set_value = CKLED2001_set_value,
+ .set_value_all = CKLED2001_set_value_all,
+};
# endif
#endif