aboutsummaryrefslogtreecommitdiff
path: root/quantum/rgb_matrix.c
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/rgb_matrix.c')
-rw-r--r--quantum/rgb_matrix.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/quantum/rgb_matrix.c b/quantum/rgb_matrix.c
index 0728e2431..413e5777f 100644
--- a/quantum/rgb_matrix.c
+++ b/quantum/rgb_matrix.c
@@ -142,11 +142,28 @@ void rgb_matrix_update_pwm_buffers(void) {
142} 142}
143 143
144void rgb_matrix_set_color( int index, uint8_t red, uint8_t green, uint8_t blue ) { 144void rgb_matrix_set_color( int index, uint8_t red, uint8_t green, uint8_t blue ) {
145#ifdef RGB_MATRIX_EXTRA_TOG
146 const bool is_key = g_rgb_leds[index].matrix_co.raw != 0xff;
147 if (
148 (rgb_matrix_config.enable == RGB_ZONE_KEYS && !is_key) ||
149 (rgb_matrix_config.enable == RGB_ZONE_UNDER && is_key)
150 ) {
151 rgb_matrix_driver.set_color(index, 0, 0, 0);
152 return;
153 }
154#endif
155
145 rgb_matrix_driver.set_color(index, red, green, blue); 156 rgb_matrix_driver.set_color(index, red, green, blue);
146} 157}
147 158
148void rgb_matrix_set_color_all( uint8_t red, uint8_t green, uint8_t blue ) { 159void rgb_matrix_set_color_all( uint8_t red, uint8_t green, uint8_t blue ) {
160#ifdef RGB_MATRIX_EXTRA_TOG
161 for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
162 rgb_matrix_set_color(i, red, green, blue);
163 }
164#else
149 rgb_matrix_driver.set_color_all(red, green, blue); 165 rgb_matrix_driver.set_color_all(red, green, blue);
166#endif
150} 167}
151 168
152bool process_rgb_matrix(uint16_t keycode, keyrecord_t *record) { 169bool process_rgb_matrix(uint16_t keycode, keyrecord_t *record) {
@@ -494,7 +511,7 @@ void rgb_matrix_set_suspend_state(bool state) {
494} 511}
495 512
496void rgb_matrix_toggle(void) { 513void rgb_matrix_toggle(void) {
497 rgb_matrix_config.enable ^= 1; 514 rgb_matrix_config.enable++;
498 if (!rgb_matrix_config.enable) { 515 if (!rgb_matrix_config.enable) {
499 rgb_task_state = STARTING; 516 rgb_task_state = STARTING;
500 } 517 }