From 41b3e399b1d43db9574c6016951d92974b3d93e7 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Thu, 5 May 2016 21:50:51 -0400 Subject: [PATCH] adds keycode shortcuts for OSL and OSM --- quantum/keymap_common.c | 8 ++++++++ quantum/keymap_common.h | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c index 5e78d1157..8f00f9cc3 100644 --- a/quantum/keymap_common.c +++ b/quantum/keymap_common.c @@ -272,6 +272,14 @@ static action_t keycode_to_action(uint16_t keycode) // Set default layer int layer = keycode & 0xFF; action.code = ACTION_LAYER_TOGGLE(layer); + } else if (type == 0x5) { + // OSL(layer) - One-shot layer + int layer = keycode & 0xFF; + action.code = ACTION_LAYER_ONESHOT(layer); + } else if (type == 0x6) { + // OSM(mod) - One-shot mod + int mod = keycode & 0xFF; + action.code = ACTION_MODS_ONESHOT(mod); } break; #ifdef MIDI_ENABLE diff --git a/quantum/keymap_common.h b/quantum/keymap_common.h index 0ede0296b..ae10bc78d 100644 --- a/quantum/keymap_common.h +++ b/quantum/keymap_common.h @@ -205,6 +205,12 @@ extern const uint16_t fn_actions[]; // Toggle to layer - 256 layer max #define TG(layer) (layer | 0x5400) +// One-shot layer - 256 layer max +#define OSL(layer) (layer | 0x5500) + +// One-shot mod +#define OSM(layer) (layer | 0x5600) + // M-od, T-ap - 256 keycode max #define MT(mod, kc) (kc | 0x7000 | ((mod & 0xF) << 8)) #define CTL_T(kc) MT(0x1, kc)