summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Silva <lukemasilva@gmail.com>2017-01-27 10:28:42 +1100
committerLuke Silva <lukemasilva@gmail.com>2017-01-27 10:28:42 +1100
commitcfc4149712217625fcb75e50348094fd9df432f5 (patch)
treed1041e50f5c4e5dc643f6fb867ce327486b94a7c
parent87bc36253dd915c51571e1972b771f49db9673d3 (diff)
Add ability to use tap macros without using functions
-rw-r--r--quantum/keymap_common.c5
-rw-r--r--quantum/quantum_keycodes.h1
2 files changed, 5 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 4853655f95..4566395fd8 100644
--- a/quantum/quantum_keycodes.h
+++ b/quantum/quantum_keycodes.h
@@ -246,6 +246,7 @@ 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