summary refs log tree commit diff
path: root/quantum
diff options
context:
space:
mode:
authorJoe Wasson <jwasson+github@gmail.com>2018-03-11 16:53:35 -0700
committerJack Humbert <jack.humb@gmail.com>2018-03-16 16:33:43 -0400
commit23ac2a02ef870dce91318a4d98e3c8ec5749bced (patch)
tree302f61696ce319d635c17e919ec6d8acf264d2ab /quantum
parent7230923b051bdb32bea19c3d732fa1fbc4883a68 (diff)
Add keycodes for swap-hands feature.
Diffstat (limited to 'quantum')
-rw-r--r--quantum/keymap_common.c6
-rw-r--r--quantum/quantum_keycodes.h14
2 files changed, 20 insertions, 0 deletions
diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c
index a0d4c1ddb0..8b09f93fce 100644
--- a/quantum/keymap_common.c
+++ b/quantum/keymap_common.c
@@ -146,6 +146,12 @@ action_t action_for_key(uint8_t layer, keypos_t key)
             action.code = ACTION_BACKLIGHT_STEP();
             break;
     #endif
+    #ifdef SWAP_HANDS_ENABLE
+        case QK_SWAP_HANDS ... QK_SWAP_HANDS_MAX:
+            action.code = ACTION(ACT_SWAP_HANDS, keycode & 0xff);
+            break;
+    #endif
+
         default:
             action.code = ACTION_NO;
             break;
diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h
index a4ee4d6bb9..9040299a74 100644
--- a/quantum/quantum_keycodes.h
+++ b/quantum/quantum_keycodes.h
@@ -77,6 +77,10 @@ enum quantum_keycodes {
     QK_STENO_GEMINI       = 0x5A31,
     QK_STENO_MAX          = 0x5A3F,
 #endif
+#ifdef SWAP_HANDS_ENABLE
+    QK_SWAP_HANDS         = 0x5B00,
+    QK_SWAP_HANDS_MAX     = 0x5BFF,
+#endif
     QK_MOD_TAP            = 0x6000,
     QK_MOD_TAP_MAX        = 0x7FFF,
 #if defined(UNICODEMAP_ENABLE) && defined(UNICODE_ENABLE)
@@ -641,4 +645,14 @@ enum quantum_keycodes {
     #define X(n) (n | QK_UNICODE_MAP)
 #endif
 
+#ifdef SWAP_HANDS_ENABLE
+  #define SH_T(key)  (QK_SWAP_HANDS | key)
+  #define SH_TG      (QK_SWAP_HANDS | OP_SH_TOGGLE)
+  #define SH_TT      (QK_SWAP_HANDS | OP_SH_TAP_TOGGLE)
+  #define SH_MON     (QK_SWAP_HANDS | OP_SH_ON_OFF)
+  #define SH_MOFF    (QK_SWAP_HANDS | OP_SH_OFF_ON)
+  #define SH_ON      (QK_SWAP_HANDS | OP_SH_ON)
+  #define SH_OFF     (QK_SWAP_HANDS | OP_SH_OFF)
+#endif
+
 #endif // QUANTUM_KEYCODES_H