Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added cancel_key_lock function #15321

Merged
merged 1 commit into from
Nov 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/feature_key_lock.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

5 changes: 5 additions & 0 deletions quantum/process_keycode/process_key_lock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions quantum/process_keycode/process_key_lock.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@

#include "quantum.h"

void cancel_key_lock(void);
bool process_key_lock(uint16_t *keycode, keyrecord_t *record);