]> git.donarmstrong.com Git - qmk_firmware.git/blobdiff - quantum/quantum.c
adds timeout to avr i2c
[qmk_firmware.git] / quantum / quantum.c
index 2662e5ef1c53f06b0a006803df51163a7cdce7ee..5abd222d19e6e4dc844b9ac08c9555107c8e8c6d 100644 (file)
@@ -230,6 +230,9 @@ bool process_record_quantum(keyrecord_t *record) {
       process_clicky(keycode, record) &&
   #endif //AUDIO_CLICKY
     process_record_kb(keycode, record) &&
+  #if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_KEYPRESSES)
+    process_rgb_matrix(keycode, record) &&
+  #endif
   #if defined(MIDI_ENABLE) && defined(MIDI_ADVANCED)
     process_midi(keycode, record) &&
   #endif
@@ -307,7 +310,7 @@ bool process_record_quantum(keyrecord_t *record) {
     }
     return false;
   #endif
-  #ifdef RGBLIGHT_ENABLE
+  #if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
   case RGB_TOG:
     if (record->event.pressed) {
       rgblight_toggle();
@@ -365,6 +368,16 @@ bool process_record_quantum(keyrecord_t *record) {
       rgblight_decrease_val();
     }
     return false;
+  case RGB_SPI:
+    if (record->event.pressed) {
+      rgblight_increase_speed();
+    }
+    return false;
+  case RGB_SPD:
+    if (record->event.pressed) {
+      rgblight_decrease_speed();
+    }
+    return false;
   case RGB_MODE_PLAIN:
     if (record->event.pressed) {
       rgblight_mode(1);
@@ -429,7 +442,12 @@ bool process_record_quantum(keyrecord_t *record) {
       }
     }
     return false;
-  #endif
+  case RGB_MODE_RGBTEST:
+    if (record->event.pressed) {
+      rgblight_mode(35);
+    }
+    return false;
+  #endif // defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
     #ifdef PROTOCOL_LUFA
     case OUT_AUTO:
       if (record->event.pressed) {
@@ -835,9 +853,18 @@ void matrix_init_quantum() {
   #ifdef AUDIO_ENABLE
     audio_init();
   #endif
+  #ifdef RGB_MATRIX_ENABLE
+    rgb_matrix_init();
+  #endif
   matrix_init_kb();
 }
 
+uint8_t rgb_matrix_task_counter = 0;
+
+#ifndef RGB_MATRIX_SKIP_FRAMES
+  #define RGB_MATRIX_SKIP_FRAMES 1
+#endif
+
 void matrix_scan_quantum() {
   #if defined(AUDIO_ENABLE)
     matrix_scan_music();
@@ -855,9 +882,16 @@ void matrix_scan_quantum() {
     backlight_task();
   #endif
 
+  #ifdef RGB_MATRIX_ENABLE
+    rgb_matrix_task();
+    if (rgb_matrix_task_counter == 0) {
+      rgb_matrix_update_pwm_buffers();
+    }
+    rgb_matrix_task_counter = ((rgb_matrix_task_counter + 1) % (RGB_MATRIX_SKIP_FRAMES + 1));
+  #endif
+
   matrix_scan_kb();
 }
-
 #if defined(BACKLIGHT_ENABLE) && defined(BACKLIGHT_PIN)
 
 static const uint8_t backlight_pin = BACKLIGHT_PIN;