aboutsummaryrefslogtreecommitdiff
path: root/quantum/quantum.c
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/quantum.c')
-rw-r--r--quantum/quantum.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/quantum/quantum.c b/quantum/quantum.c
index 2662e5ef1..e1bc8b242 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -230,6 +230,9 @@ bool process_record_quantum(keyrecord_t *record) {
230 process_clicky(keycode, record) && 230 process_clicky(keycode, record) &&
231 #endif //AUDIO_CLICKY 231 #endif //AUDIO_CLICKY
232 process_record_kb(keycode, record) && 232 process_record_kb(keycode, record) &&
233 #if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_KEYPRESSES)
234 process_rgb_matrix(keycode, record) &&
235 #endif
233 #if defined(MIDI_ENABLE) && defined(MIDI_ADVANCED) 236 #if defined(MIDI_ENABLE) && defined(MIDI_ADVANCED)
234 process_midi(keycode, record) && 237 process_midi(keycode, record) &&
235 #endif 238 #endif
@@ -307,7 +310,7 @@ bool process_record_quantum(keyrecord_t *record) {
307 } 310 }
308 return false; 311 return false;
309 #endif 312 #endif
310 #ifdef RGBLIGHT_ENABLE 313 #if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
311 case RGB_TOG: 314 case RGB_TOG:
312 if (record->event.pressed) { 315 if (record->event.pressed) {
313 rgblight_toggle(); 316 rgblight_toggle();
@@ -835,9 +838,18 @@ void matrix_init_quantum() {
835 #ifdef AUDIO_ENABLE 838 #ifdef AUDIO_ENABLE
836 audio_init(); 839 audio_init();
837 #endif 840 #endif
841 #ifdef RGB_MATRIX_ENABLE
842 rgb_matrix_init_drivers();
843 #endif
838 matrix_init_kb(); 844 matrix_init_kb();
839} 845}
840 846
847uint8_t rgb_matrix_task_counter = 0;
848
849#ifndef RGB_MATRIX_SKIP_FRAMES
850 #define RGB_MATRIX_SKIP_FRAMES 1
851#endif
852
841void matrix_scan_quantum() { 853void matrix_scan_quantum() {
842 #if defined(AUDIO_ENABLE) 854 #if defined(AUDIO_ENABLE)
843 matrix_scan_music(); 855 matrix_scan_music();
@@ -855,9 +867,16 @@ void matrix_scan_quantum() {
855 backlight_task(); 867 backlight_task();
856 #endif 868 #endif
857 869
870 #ifdef RGB_MATRIX_ENABLE
871 rgb_matrix_task();
872 if (rgb_matrix_task_counter == 0) {
873 rgb_matrix_update_pwm_buffers();
874 }
875 rgb_matrix_task_counter = ((rgb_matrix_task_counter + 1) % (RGB_MATRIX_SKIP_FRAMES + 1));
876 #endif
877
858 matrix_scan_kb(); 878 matrix_scan_kb();
859} 879}
860
861#if defined(BACKLIGHT_ENABLE) && defined(BACKLIGHT_PIN) 880#if defined(BACKLIGHT_ENABLE) && defined(BACKLIGHT_PIN)
862 881
863static const uint8_t backlight_pin = BACKLIGHT_PIN; 882static const uint8_t backlight_pin = BACKLIGHT_PIN;