diff options
author | Simon Melhart <simon.snth@xoxy.net> | 2013-11-20 00:29:09 +0100 |
---|---|---|
committer | Simon Melhart <simon.snth@xoxy.net> | 2013-11-20 18:21:33 +0100 |
commit | a6afa845b98d4fa7097c840fedbace59fef8f738 (patch) | |
tree | 9c437cd6e0208afb2b681550b4e9cdac594150bc /common | |
parent | 821578293c79c5612f9b77e447295f2947fd6c3d (diff) | |
download | qmk_firmware-a6afa845b98d4fa7097c840fedbace59fef8f738.tar.gz qmk_firmware-a6afa845b98d4fa7097c840fedbace59fef8f738.tar.xz |
Add tap toggle modifiers
Including documentation.
Diffstat (limited to 'common')
-rw-r--r-- | common/action.c | 11 | ||||
-rw-r--r-- | common/action_code.h | 3 |
2 files changed, 14 insertions, 0 deletions
diff --git a/common/action.c b/common/action.c index f7ae85b94..38ee12abe 100644 --- a/common/action.c +++ b/common/action.c @@ -128,6 +128,17 @@ void process_action(keyrecord_t *record) } break; #endif + case MODS_TAP_TOGGLE: + if (event.pressed) { + if (tap_count <= TAPPING_TOGGLE) { + register_mods(mods); + } + } else { + if (tap_count < TAPPING_TOGGLE) { + unregister_mods(mods); + } + } + break; default: if (event.pressed) { if (tap_count > 0) { diff --git a/common/action_code.h b/common/action_code.h index c153838f2..bd3652e38 100644 --- a/common/action_code.h +++ b/common/action_code.h @@ -34,6 +34,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. * * ACT_MODS_TAP(001r): * 001r|mods|0000 0000 Modifiers with OneShot + * 001r|mods|0000 0001 Modifiers with tap toggle * 001r|mods|0000 00xx (reserved) * 001r|mods| keycode Modifiers with Tap Key(Dual role) * @@ -205,12 +206,14 @@ enum mods_bit { }; enum mods_codes { MODS_ONESHOT = 0x00, + MODS_TAP_TOGGLE = 0x01, }; #define ACTION_KEY(key) ACTION(ACT_MODS, (key)) #define ACTION_MODS(mods) ACTION(ACT_MODS, (mods&0x1f)<<8 | 0) #define ACTION_MODS_KEY(mods, key) ACTION(ACT_MODS, (mods&0x1f)<<8 | (key)) #define ACTION_MODS_TAP_KEY(mods, key) ACTION(ACT_MODS_TAP, (mods&0x1f)<<8 | (key)) #define ACTION_MODS_ONESHOT(mods) ACTION(ACT_MODS_TAP, (mods&0x1f)<<8 | MODS_ONESHOT) +#define ACTION_MODS_TAP_TOGGLE(mods) ACTION(ACT_MODS_TAP, (mods&0x1f)<<8 | MODS_TAP_TOGGLE) /* |