diff options
author | lalalademaxiya1 <66767061+lalalademaxiya1@users.noreply.github.com> | 2021-11-02 06:43:53 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-02 09:43:53 +1100 |
commit | f4ea262c17ecd53b18180a19c33a9ba5da70ec9d (patch) | |
tree | a516e7d9c406476c78f6e2472d195db7a8c39c2b /quantum | |
parent | 9d235d4fc5c34f372b0c393f41686b5ef4f8dc13 (diff) | |
download | qmk_firmware-f4ea262c17ecd53b18180a19c33a9ba5da70ec9d.tar.gz qmk_firmware-f4ea262c17ecd53b18180a19c33a9ba5da70ec9d.zip |
Add a new led driver for Keychron's keyboards. (#14872)
* Add a new led driver for Keychron's keyboards.
* Update ckled2001.c/ckled2001.h.
* Update ckled2001.c/ckled2001.h.
* Update ckled2001.c/ckled2001.h.
* Update ckled2001.c
* Add a new led driver
* Update ckled2001.c
* Update ckled2001.c
* Update ckled2001.c
* Update ckled2001.c
* Delete ckled2001.c
* Create ckled2001.c
* Update ckled2001.c
* Update chibios-contrib
Co-authored-by: keychron-dev <85598583+keychron-dev@users.noreply.github.com>
Co-authored-by: lokher <lokher@gmail.com>
Diffstat (limited to 'quantum')
-rw-r--r-- | quantum/rgb_matrix/rgb_matrix.h | 2 | ||||
-rw-r--r-- | quantum/rgb_matrix/rgb_matrix_drivers.c | 49 |
2 files changed, 50 insertions, 1 deletions
diff --git a/quantum/rgb_matrix/rgb_matrix.h b/quantum/rgb_matrix/rgb_matrix.h index 112dfaaae..af5ca9e79 100644 --- a/quantum/rgb_matrix/rgb_matrix.h +++ b/quantum/rgb_matrix/rgb_matrix.h | |||
@@ -33,6 +33,8 @@ | |||
33 | # include "is31fl3737.h" | 33 | # include "is31fl3737.h" |
34 | #elif defined(IS31FL3741) | 34 | #elif defined(IS31FL3741) |
35 | # include "is31fl3741.h" | 35 | # include "is31fl3741.h" |
36 | #elif defined(CKLED2001) | ||
37 | # include "ckled2001.h" | ||
36 | #elif defined(AW20216) | 38 | #elif defined(AW20216) |
37 | # include "aw20216.h" | 39 | # include "aw20216.h" |
38 | #elif defined(WS2812) | 40 | #elif defined(WS2812) |
diff --git a/quantum/rgb_matrix/rgb_matrix_drivers.c b/quantum/rgb_matrix/rgb_matrix_drivers.c index 949cc3661..130ca47a6 100644 --- a/quantum/rgb_matrix/rgb_matrix_drivers.c +++ b/quantum/rgb_matrix/rgb_matrix_drivers.c | |||
@@ -23,7 +23,7 @@ | |||
23 | * be here if shared between boards. | 23 | * be here if shared between boards. |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #if defined(IS31FL3731) || defined(IS31FL3733) || defined(IS31FL3737) || defined(IS31FL3741) | 26 | #if defined(IS31FL3731) || defined(IS31FL3733) || defined(IS31FL3737) || defined(IS31FL3741) || defined(CKLED2001) |
27 | # include "i2c_master.h" | 27 | # include "i2c_master.h" |
28 | 28 | ||
29 | // TODO: Remove this at some later date | 29 | // TODO: Remove this at some later date |
@@ -80,6 +80,18 @@ static void init(void) { | |||
80 | 80 | ||
81 | # elif defined(IS31FL3741) | 81 | # elif defined(IS31FL3741) |
82 | IS31FL3741_init(DRIVER_ADDR_1); | 82 | IS31FL3741_init(DRIVER_ADDR_1); |
83 | |||
84 | # elif defined(CKLED2001) | ||
85 | CKLED2001_init(DRIVER_ADDR_1); | ||
86 | # if defined(DRIVER_ADDR_2) | ||
87 | CKLED2001_init(DRIVER_ADDR_2); | ||
88 | # if defined(DRIVER_ADDR_3) | ||
89 | CKLED2001_init(DRIVER_ADDR_3); | ||
90 | # if defined(DRIVER_ADDR_4) | ||
91 | CKLED2001_init(DRIVER_ADDR_4); | ||
92 | # endif | ||
93 | # endif | ||
94 | # endif | ||
83 | # endif | 95 | # endif |
84 | 96 | ||
85 | for (int index = 0; index < DRIVER_LED_TOTAL; index++) { | 97 | for (int index = 0; index < DRIVER_LED_TOTAL; index++) { |
@@ -94,6 +106,8 @@ static void init(void) { | |||
94 | IS31FL3737_set_led_control_register(index, enabled, enabled, enabled); | 106 | IS31FL3737_set_led_control_register(index, enabled, enabled, enabled); |
95 | # elif defined(IS31FL3741) | 107 | # elif defined(IS31FL3741) |
96 | IS31FL3741_set_led_control_register(index, enabled, enabled, enabled); | 108 | IS31FL3741_set_led_control_register(index, enabled, enabled, enabled); |
109 | # elif defined(CKLED2001) | ||
110 | CKLED2001_set_led_control_register(index, enabled, enabled, enabled); | ||
97 | # endif | 111 | # endif |
98 | } | 112 | } |
99 | 113 | ||
@@ -130,6 +144,18 @@ static void init(void) { | |||
130 | 144 | ||
131 | # elif defined(IS31FL3741) | 145 | # elif defined(IS31FL3741) |
132 | IS31FL3741_update_led_control_registers(DRIVER_ADDR_1, 0); | 146 | IS31FL3741_update_led_control_registers(DRIVER_ADDR_1, 0); |
147 | |||
148 | # elif defined(CKLED2001) | ||
149 | CKLED2001_update_led_control_registers(DRIVER_ADDR_1, 0); | ||
150 | # if defined(DRIVER_ADDR_2) | ||
151 | CKLED2001_update_led_control_registers(DRIVER_ADDR_2, 1); | ||
152 | # if defined(DRIVER_ADDR_3) | ||
153 | CKLED2001_update_led_control_registers(DRIVER_ADDR_3, 2); | ||
154 | # if defined(DRIVER_ADDR_4) | ||
155 | CKLED2001_update_led_control_registers(DRIVER_ADDR_4, 3); | ||
156 | # endif | ||
157 | # endif | ||
158 | # endif | ||
133 | # endif | 159 | # endif |
134 | } | 160 | } |
135 | 161 | ||
@@ -204,6 +230,27 @@ const rgb_matrix_driver_t rgb_matrix_driver = { | |||
204 | .set_color = IS31FL3741_set_color, | 230 | .set_color = IS31FL3741_set_color, |
205 | .set_color_all = IS31FL3741_set_color_all, | 231 | .set_color_all = IS31FL3741_set_color_all, |
206 | }; | 232 | }; |
233 | |||
234 | # elif defined(CKLED2001) | ||
235 | static void flush(void) { | ||
236 | CKLED2001_update_pwm_buffers(DRIVER_ADDR_1, 0); | ||
237 | # if defined(DRIVER_ADDR_2) | ||
238 | CKLED2001_update_pwm_buffers(DRIVER_ADDR_2, 1); | ||
239 | # if defined(DRIVER_ADDR_3) | ||
240 | CKLED2001_update_pwm_buffers(DRIVER_ADDR_3, 2); | ||
241 | # if defined(DRIVER_ADDR_4) | ||
242 | CKLED2001_update_pwm_buffers(DRIVER_ADDR_4, 3); | ||
243 | # endif | ||
244 | # endif | ||
245 | # endif | ||
246 | } | ||
247 | |||
248 | const rgb_matrix_driver_t rgb_matrix_driver = { | ||
249 | .init = init, | ||
250 | .flush = flush, | ||
251 | .set_color = CKLED2001_set_color, | ||
252 | .set_color_all = CKLED2001_set_color_all, | ||
253 | }; | ||
207 | # endif | 254 | # endif |
208 | 255 | ||
209 | #elif defined(AW20216) | 256 | #elif defined(AW20216) |