]> git.donarmstrong.com Git - qmk_firmware.git/blobdiff - quantum/quantum.c
Added SS_TAP_CODE, SS_DOWN_CODE, SS_UP_CODE
[qmk_firmware.git] / quantum / quantum.c
index 376578ade42602b0b61a6b55a3722745b3bdc029..96760de87e7032bba1e01d560bb95d50b984ebe4 100644 (file)
@@ -47,6 +47,13 @@ extern backlight_config_t backlight_config;
 #include "process_midi.h"
 #endif
 
+#ifdef VELOCIKEY_ENABLE
+#include "velocikey.h"
+#endif
+
+#ifdef HAPTIC_ENABLE
+    #include "haptic.h"
+#endif
 
 #ifdef ENCODER_ENABLE
 #include "encoder.h"
@@ -179,6 +186,9 @@ void reset_keyboard(void) {
   shutdown_user();
   wait_ms(250);
 #endif
+#ifdef HAPTIC_ENABLE
+  haptic_shutdown();
+#endif
 // this is also done later in bootloader.c - not sure if it's neccesary here
 #ifdef BOOTLOADER_CATERINA
   *(uint16_t *)0x0800 = 0x7777; // these two are a-star-specific
@@ -245,6 +255,10 @@ bool process_record_quantum(keyrecord_t *record) {
     //   return false;
     // }
 
+  #ifdef VELOCIKEY_ENABLE
+    if (velocikey_enabled() && record->event.pressed) { velocikey_accelerate(); }
+  #endif
+
   #ifdef TAP_DANCE_ENABLE
     preprocess_tap_dance(keycode, record);
   #endif
@@ -257,6 +271,9 @@ bool process_record_quantum(keyrecord_t *record) {
   #if defined(AUDIO_ENABLE) && defined(AUDIO_CLICKY)
     process_clicky(keycode, record) &&
   #endif //AUDIO_CLICKY
+  #ifdef HAPTIC_ENABLE
+    process_haptic(keycode, record) &&
+  #endif //HAPTIC_ENABLE
     process_record_kb(keycode, record) &&
   #if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_KEYPRESSES)
     process_rgb_matrix(keycode, record) &&
@@ -559,7 +576,14 @@ bool process_record_quantum(keyrecord_t *record) {
   #endif
     return false;
   #endif // defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
-    #ifdef PROTOCOL_LUFA
+  #ifdef VELOCIKEY_ENABLE
+    case VLK_TOG:
+      if (record->event.pressed) {
+        velocikey_toggle();
+      }
+      return false;
+  #endif
+  #ifdef PROTOCOL_LUFA
     case OUT_AUTO:
       if (record->event.pressed) {
         set_output(OUTPUT_AUTO);
@@ -876,16 +900,16 @@ void send_string_with_delay(const char *str, uint8_t interval) {
     while (1) {
         char ascii_code = *str;
         if (!ascii_code) break;
-        if (ascii_code == 1) {
+        if (ascii_code == SS_TAP_CODE) {
           // tap
           uint8_t keycode = *(++str);
           register_code(keycode);
           unregister_code(keycode);
-        } else if (ascii_code == 2) {
+        } else if (ascii_code == SS_DOWN_CODE) {
           // down
           uint8_t keycode = *(++str);
           register_code(keycode);
-        } else if (ascii_code == 3) {
+        } else if (ascii_code == SS_UP_CODE) {
           // up
           uint8_t keycode = *(++str);
           unregister_code(keycode);
@@ -902,16 +926,16 @@ void send_string_with_delay_P(const char *str, uint8_t interval) {
     while (1) {
         char ascii_code = pgm_read_byte(str);
         if (!ascii_code) break;
-        if (ascii_code == 1) {
+        if (ascii_code == SS_TAP_CODE) {
           // tap
           uint8_t keycode = pgm_read_byte(++str);
           register_code(keycode);
           unregister_code(keycode);
-        } else if (ascii_code == 2) {
+        } else if (ascii_code == SS_DOWN_CODE) {
           // down
           uint8_t keycode = pgm_read_byte(++str);
           register_code(keycode);
-        } else if (ascii_code == 3) {
+        } else if (ascii_code == SS_UP_CODE) {
           // up
           uint8_t keycode = pgm_read_byte(++str);
           unregister_code(keycode);
@@ -1049,6 +1073,9 @@ void matrix_init_quantum() {
   #if defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE)
     unicode_input_mode_init();
   #endif
+  #ifdef HAPTIC_ENABLE
+    haptic_init();
+  #endif
   matrix_init_kb();
 }
 
@@ -1091,6 +1118,10 @@ void matrix_scan_quantum() {
     encoder_read();
   #endif
 
+  #ifdef HAPTIC_ENABLE
+    haptic_task();
+  #endif
+
   matrix_scan_kb();
 }
 #if defined(BACKLIGHT_ENABLE) && defined(BACKLIGHT_PIN)