]> git.donarmstrong.com Git - tmk_firmware.git/blobdiff - common/action.c
Experimental additions to LUFA makefile
[tmk_firmware.git] / common / action.c
index b1fa0e31cf7798c4cdbf49efa83d9a0e97a4575b..59c6f252dcdbc6a08695d88259ba5b99ff350b6e 100644 (file)
@@ -237,7 +237,7 @@ void process_action(keyrecord_t *record)
             break;
     #ifndef NO_ACTION_TAPPING
         case ACT_LAYER_TAP:
-        case ACT_LAYER_TAP1:
+        case ACT_LAYER_TAP_EXT:
             switch (action.layer_tap.code) {
                 case OP_TAP_TOGGLE:
                     /* tap toggle */
@@ -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)
@@ -458,7 +514,7 @@ bool is_tap_key(key_t key)
         case ACT_LMODS_TAP:
         case ACT_RMODS_TAP:
         case ACT_LAYER_TAP:
-        case ACT_LAYER_TAP1:
+        case ACT_LAYER_TAP_EXT:
             return true;
         case ACT_MACRO:
         case ACT_FUNCTION:
@@ -496,7 +552,7 @@ void debug_action(action_t action)
         case ACT_MOUSEKEY:          dprint("ACT_MOUSEKEY");          break;
         case ACT_LAYER:             dprint("ACT_LAYER");             break;
         case ACT_LAYER_TAP:         dprint("ACT_LAYER_TAP");         break;
-        case ACT_LAYER_TAP1:        dprint("ACT_LAYER_TAP1");        break;
+        case ACT_LAYER_TAP_EXT:     dprint("ACT_LAYER_TAP_EXT");     break;
         case ACT_MACRO:             dprint("ACT_MACRO");             break;
         case ACT_COMMAND:           dprint("ACT_COMMAND");           break;
         case ACT_FUNCTION:          dprint("ACT_FUNCTION");          break;