summaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2017-02-07 13:18:47 -0500
committerGitHub <noreply@github.com>2017-02-07 13:18:47 -0500
commit3c7fa0acc10305a573bc3bb29243a7a3d601579b (patch)
tree49aa463e861b30c3fa0bd454679e1aefebcb7c9c /quantum
parent0c2b6951a6ad80649798c0eca36a9999ebae0b13 (diff)
parent77e54e34e129a03e58c128171a7188978ec908b4 (diff)
Merge pull request #1046 from LukeSilva/master
Add Tapping Macros to QMK
Diffstat (limited to 'quantum')
-rw-r--r--quantum/keymap_common.c5
-rw-r--r--quantum/quantum_keycodes.h2
2 files changed, 6 insertions, 1 deletions
diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c
index eced3d2bba..5190f24e87 100644
--- a/quantum/keymap_common.c
+++ b/quantum/keymap_common.c
@@ -80,7 +80,10 @@ action_t action_for_key(uint8_t layer, keypos_t key)
action.code = keymap_function_id_to_action( (int)keycode & 0xFFF );
break;
case QK_MACRO ... QK_MACRO_MAX:
- action.code = ACTION_MACRO(keycode & 0xFF);
+ if (keycode & 0x800) // tap macros have upper bit set
+ action.code = ACTION_MACRO_TAP(keycode & 0xFF);
+ else
+ action.code = ACTION_MACRO(keycode & 0xFF);
break;
case QK_LAYER_TAP ... QK_LAYER_TAP_MAX:
action.code = ACTION_LAYER_TAP_KEY((keycode >> 0x8) & 0xF, keycode & 0xFF);
diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h
index a786bd322f..8a78a58c9f 100644
--- a/quantum/quantum_keycodes.h
+++ b/quantum/quantum_keycodes.h
@@ -256,8 +256,10 @@ enum quantum_keycodes {
#define M(kc) (kc | QK_MACRO)
+#define MACROTAP(kc) (kc | QK_MACRO | FUNC_TAP<<8)
#define MACRODOWN(...) (record->event.pressed ? MACRO(__VA_ARGS__) : MACRO_NONE)
+
// L-ayer, T-ap - 256 keycode max, 16 layer max
#define LT(layer, kc) (kc | QK_LAYER_TAP | ((layer & 0xF) << 8))