summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2017-02-15 11:25:33 -0500
committerJack Humbert <jack.humb@gmail.com>2017-02-15 11:25:33 -0500
commit69ea10f9a9407415d8cbb5575a08bd73d5ddd7f9 (patch)
treeca2ed059803bdb8316b76272dafafe54593758cf
parent7bef285553dee01bbcb1eaadefbfb39ed75baea4 (diff)
downloadqmk_firmware-69ea10f9a9407415d8cbb5575a08bd73d5ddd7f9.tar.gz
qmk_firmware-69ea10f9a9407415d8cbb5575a08bd73d5ddd7f9.zip
adds layer tap toggle
-rw-r--r--quantum/keymap_common.c3
-rw-r--r--quantum/quantum_keycodes.h13
2 files changed, 12 insertions, 4 deletions
diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c
index 54b872d49e..002eabd85e 100644
--- a/quantum/keymap_common.c
+++ b/quantum/keymap_common.c
@@ -119,6 +119,9 @@ action_t action_for_key(uint8_t layer, keypos_t key)
mod = keycode & 0xFF;
action.code = ACTION_MODS_ONESHOT(mod);
break;
+ case QK_LAYER_TAP_TOGGLE ... QK_LAYER_TAP_TOGGLE_MAX:
+ action.code = ACTION_LAYER_TAP_TOGGLE(keycode & 0xFF);
+ break;
case QK_MOD_TAP ... QK_MOD_TAP_MAX:
action.code = ACTION_MODS_TAP_KEY((keycode >> 0x8) & 0x1F, keycode & 0xFF);
break;
diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h
index cc7a5013f6..f36c8044e9 100644
--- a/quantum/quantum_keycodes.h
+++ b/quantum/quantum_keycodes.h
@@ -41,16 +41,18 @@ enum quantum_keycodes {
#endif
QK_TAP_DANCE = 0x5700,
QK_TAP_DANCE_MAX = 0x57FF,
-#ifdef UNICODEMAP_ENABLE
- QK_UNICODE_MAP = 0x5800,
- QK_UNICODE_MAP_MAX = 0x5BFF,
-#endif
+ QK_LAYER_TAP_TOGGLE = 0x5800,
+ QK_LAYER_TAP_TOGGLE_MAX = 0x58FF,
QK_MOD_TAP = 0x6000,
QK_MOD_TAP_MAX = 0x7FFF,
#ifdef UNICODE_ENABLE
QK_UNICODE = 0x8000,
QK_UNICODE_MAX = 0xFFFF,
#endif
+#ifdef UNICODEMAP_ENABLE
+ QK_UNICODE_MAP = 0x8000,
+ QK_UNICODE_MAP_MAX = 0x83FF,
+#endif
// Loose keycodes - to be used directly
@@ -304,6 +306,9 @@ enum quantum_keycodes {
// One-shot mod
#define OSM(mod) (mod | QK_ONE_SHOT_MOD)
+// Layer tap-toggle
+#define TT(layer) (layer | QK_LAYER_TAP_TOGGLE)
+
// M-od, T-ap - 256 keycode max
#define MT(mod, kc) (kc | QK_MOD_TAP | ((mod & 0x1F) << 8))