skylark-qmk/users/dshields/dshields.c
Daniel Shields d6fb8f12c6
[Keymap] Initial commit for keyboardio/atreus/dshields keymap. (#11946)
Incorporating changes suggested during pull request review.

Co-authored-by: Daniel Shields <dshields@cboe.com>
2021-02-28 17:07:55 +11:00

31 lines
938 B
C

#include "quantum.h"
#include "dshields.h"
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX)
|| (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)
|| (keycode >= QK_MODS && keycode <= QK_MODS_MAX)) {
keycode = keycode & 0xFF;
}
if (keycode == KC_ESC && record->event.pressed) {
bool rc = true;
uint8_t mods = 0;
if ((mods = get_oneshot_mods()) && !has_oneshot_mods_timed_out()) {
clear_oneshot_mods();
unregister_mods(mods);
rc = false;
}
if ((mods = get_oneshot_locked_mods())) {
clear_oneshot_locked_mods();
unregister_mods(mods);
rc = false;
}
if (is_oneshot_layer_active()) {
layer_clear();
rc = false;
}
return rc;
}
return true;
}