]> git.donarmstrong.com Git - tmk_firmware.git/blobdiff - common/action.c
Merge branch 'tapping_fix60'
[tmk_firmware.git] / common / action.c
index a42a7a4aeeee536ce3b31bd66b68b26830bf1b85..59c6f252dcdbc6a08695d88259ba5b99ff350b6e 100644 (file)
@@ -336,9 +336,10 @@ void register_code(uint8_t code)
     if (code == KC_NO) {
         return;
     }
-#ifdef CAPSLOCK_LOCKING_ENABLE
+
+#ifdef LOCKING_SUPPORT_ENABLE
     else if (KC_LOCKING_CAPS == code) {
-#ifdef CAPSLOCK_LOCKING_RESYNC_ENABLE
+#ifdef LOCKING_RESYNC_ENABLE
         // Resync: ignore if caps lock already is on
         if (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) return;
 #endif
@@ -347,7 +348,28 @@ void register_code(uint8_t code)
         host_del_key(KC_CAPSLOCK);
         host_send_keyboard_report();
     }
+
+    else if (KC_LOCKING_NUM == code) {
+#ifdef LOCKING_RESYNC_ENABLE
+        if (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) return;
+#endif
+        host_add_key(KC_NUMLOCK);
+        host_send_keyboard_report();
+        host_del_key(KC_NUMLOCK);
+        host_send_keyboard_report();
+    }
+
+    else if (KC_LOCKING_SCROLL == code) {
+#ifdef LOCKING_RESYNC_ENABLE
+        if (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) return;
+#endif
+        host_add_key(KC_SCROLLLOCK);
+        host_send_keyboard_report();
+        host_del_key(KC_SCROLLLOCK);
+        host_send_keyboard_report();
+    }
 #endif
+
     else if IS_KEY(code) {
         // TODO: should push command_proc out of this block?
         if (command_proc(code)) return;
@@ -373,6 +395,12 @@ void register_code(uint8_t code)
         host_add_mods(MOD_BIT(code));
         host_send_keyboard_report();
     }
+    else if IS_SYSTEM(code) {
+        host_system_send(KEYCODE2SYSTEM(code));
+    }
+    else if IS_CONSUMER(code) {
+        host_consumer_send(KEYCODE2CONSUMER(code));
+    }
 }
 
 void unregister_code(uint8_t code)
@@ -380,9 +408,10 @@ void unregister_code(uint8_t code)
     if (code == KC_NO) {
         return;
     }
-#ifdef CAPSLOCK_LOCKING_ENABLE
+
+#ifdef LOCKING_SUPPORT_ENABLE
     else if (KC_LOCKING_CAPS == code) {
-#ifdef CAPSLOCK_LOCKING_RESYNC_ENABLE
+#ifdef LOCKING_RESYNC_ENABLE
         // Resync: ignore if caps lock already is off
         if (!(host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK))) return;
 #endif
@@ -391,7 +420,28 @@ void unregister_code(uint8_t code)
         host_del_key(KC_CAPSLOCK);
         host_send_keyboard_report();
     }
+
+    else if (KC_LOCKING_NUM == code) {
+#ifdef LOCKING_RESYNC_ENABLE
+        if (!(host_keyboard_leds() & (1<<USB_LED_NUM_LOCK))) return;
+#endif
+        host_add_key(KC_NUMLOCK);
+        host_send_keyboard_report();
+        host_del_key(KC_NUMLOCK);
+        host_send_keyboard_report();
+    }
+
+    else if (KC_LOCKING_SCROLL == code) {
+#ifdef LOCKING_RESYNC_ENABLE
+        if (!(host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK))) return;
+#endif
+        host_add_key(KC_SCROLLLOCK);
+        host_send_keyboard_report();
+        host_del_key(KC_SCROLLLOCK);
+        host_send_keyboard_report();
+    }
 #endif
+
     else if IS_KEY(code) {
         host_del_key(code);
         host_send_keyboard_report();
@@ -400,6 +450,12 @@ void unregister_code(uint8_t code)
         host_del_mods(MOD_BIT(code));
         host_send_keyboard_report();
     }
+    else if IS_SYSTEM(code) {
+        host_system_send(0);
+    }
+    else if IS_CONSUMER(code) {
+        host_consumer_send(0);
+    }
 }
 
 void add_mods(uint8_t mods)