Added cancel_key_lock function (#15321)

This commit is contained in:
wheredoesyourmindgo 2021-11-29 00:17:07 -08:00 committed by GitHub
parent 4461355cce
commit 7f67504993
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 1 deletions

View file

@ -19,4 +19,5 @@ First, enable Key Lock by setting `KEY_LOCK_ENABLE = yes` in your `rules.mk`. Th
Key Lock is only able to hold standard action keys and [One Shot modifier](one_shot_keys.md) keys (for example, if you have your Shift defined as `OSM(KC_LSFT)`).
This does not include any of the QMK special functions (except One Shot modifiers), or shifted versions of keys such as `KC_LPRN`. If it's in the [Basic Keycodes](keycodes_basic.md) list, it can be held.
Switching layers will not cancel the Key Lock.
Switching layers will not cancel the Key Lock. The Key Lock can be cancelled by calling the `cancel_key_lock()` function.

View file

@ -56,6 +56,11 @@ static inline uint16_t translate_keycode(uint16_t keycode) {
}
}
void cancel_key_lock(void) {
watching = false;
UNSET_KEY_STATE(0x0);
}
bool process_key_lock(uint16_t *keycode, keyrecord_t *record) {
// We start by categorizing the keypress event. In the event of a down
// event, there are several possibilities:

View file

@ -18,4 +18,5 @@
#include "quantum.h"
void cancel_key_lock(void);
bool process_key_lock(uint16_t *keycode, keyrecord_t *record);