adds layer tap toggle

This commit is contained in:
Jack Humbert 2017-02-15 11:25:33 -05:00
parent 7bef285553
commit 69ea10f9a9
2 changed files with 12 additions and 4 deletions

View File

@ -119,6 +119,9 @@ action_t action_for_key(uint8_t layer, keypos_t key)
mod = keycode & 0xFF; mod = keycode & 0xFF;
action.code = ACTION_MODS_ONESHOT(mod); action.code = ACTION_MODS_ONESHOT(mod);
break; 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: case QK_MOD_TAP ... QK_MOD_TAP_MAX:
action.code = ACTION_MODS_TAP_KEY((keycode >> 0x8) & 0x1F, keycode & 0xFF); action.code = ACTION_MODS_TAP_KEY((keycode >> 0x8) & 0x1F, keycode & 0xFF);
break; break;

View File

@ -41,16 +41,18 @@ enum quantum_keycodes {
#endif #endif
QK_TAP_DANCE = 0x5700, QK_TAP_DANCE = 0x5700,
QK_TAP_DANCE_MAX = 0x57FF, QK_TAP_DANCE_MAX = 0x57FF,
#ifdef UNICODEMAP_ENABLE QK_LAYER_TAP_TOGGLE = 0x5800,
QK_UNICODE_MAP = 0x5800, QK_LAYER_TAP_TOGGLE_MAX = 0x58FF,
QK_UNICODE_MAP_MAX = 0x5BFF,
#endif
QK_MOD_TAP = 0x6000, QK_MOD_TAP = 0x6000,
QK_MOD_TAP_MAX = 0x7FFF, QK_MOD_TAP_MAX = 0x7FFF,
#ifdef UNICODE_ENABLE #ifdef UNICODE_ENABLE
QK_UNICODE = 0x8000, QK_UNICODE = 0x8000,
QK_UNICODE_MAX = 0xFFFF, QK_UNICODE_MAX = 0xFFFF,
#endif #endif
#ifdef UNICODEMAP_ENABLE
QK_UNICODE_MAP = 0x8000,
QK_UNICODE_MAP_MAX = 0x83FF,
#endif
// Loose keycodes - to be used directly // Loose keycodes - to be used directly
@ -304,6 +306,9 @@ enum quantum_keycodes {
// One-shot mod // One-shot mod
#define OSM(mod) (mod | QK_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 // M-od, T-ap - 256 keycode max
#define MT(mod, kc) (kc | QK_MOD_TAP | ((mod & 0x1F) << 8)) #define MT(mod, kc) (kc | QK_MOD_TAP | ((mod & 0x1F) << 8))