diff options
author | Nick Brassel <nick@tzarc.org> | 2023-02-28 11:22:29 +1100 |
---|---|---|
committer | Nick Brassel <nick@tzarc.org> | 2023-02-28 11:22:29 +1100 |
commit | bacec14073b2e897d5a52caf12de5a6a1f7b4078 (patch) | |
tree | d4e3e57aac1a829a191831efd2e62c8a43217885 /quantum/quantum.c | |
parent | d70e9b8659a7fbbd7069fd542bd07e67e04327a1 (diff) | |
parent | b865b9e1706ad28ae4882bd2e0331e98808295fa (diff) |
Merge remote-tracking branch 'upstream/develop'
Diffstat (limited to 'quantum/quantum.c')
-rw-r--r-- | quantum/quantum.c | 45 |
1 files changed, 15 insertions, 30 deletions
diff --git a/quantum/quantum.c b/quantum/quantum.c index e7dc71e5d7..0587f215fe 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -76,7 +76,7 @@ void do_code16(uint16_t code, void (*f)(uint8_t)) { } __attribute__((weak)) void register_code16(uint16_t code) { - if (IS_MOD(code) || code == KC_NO) { + if (IS_MODIFIER_KEYCODE(code) || code == KC_NO) { do_code16(code, register_mods); } else { do_code16(code, register_weak_mods); @@ -86,7 +86,7 @@ __attribute__((weak)) void register_code16(uint16_t code) { __attribute__((weak)) void unregister_code16(uint16_t code) { unregister_code(code); - if (IS_MOD(code) || code == KC_NO) { + if (IS_MODIFIER_KEYCODE(code) || code == KC_NO) { do_code16(code, unregister_mods); } else { do_code16(code, unregister_weak_mods); @@ -238,6 +238,14 @@ bool process_record_quantum(keyrecord_t *record) { } #endif +#ifdef TAP_DANCE_ENABLE + if (preprocess_tap_dance(keycode, record)) { + // The tap dance might have updated the layer state, therefore the + // result of the keycode lookup might change. + keycode = get_record_keycode(record, true); + } +#endif + #ifdef VELOCIKEY_ENABLE if (velocikey_enabled() && record->event.pressed) { velocikey_accelerate(); @@ -250,14 +258,6 @@ bool process_record_quantum(keyrecord_t *record) { } #endif -#ifdef TAP_DANCE_ENABLE - if (preprocess_tap_dance(keycode, record)) { - // The tap dance might have updated the layer state, therefore the - // result of the keycode lookup might change. - keycode = get_record_keycode(record, true); - } -#endif - if (!( #if defined(KEY_LOCK_ENABLE) // Must run first to be able to mask key_up events. @@ -343,6 +343,9 @@ bool process_record_quantum(keyrecord_t *record) { #ifdef AUTOCORRECT_ENABLE process_autocorrect(keycode, record) && #endif +#ifdef TRI_LAYER_ENABLE + process_tri_layer(keycode, record) && +#endif true)) { return false; } @@ -443,31 +446,13 @@ void set_single_persistent_default_layer(uint8_t default_layer) { default_layer_set((layer_state_t)1 << default_layer); } -layer_state_t update_tri_layer_state(layer_state_t state, uint8_t layer1, uint8_t layer2, uint8_t layer3) { - layer_state_t mask12 = ((layer_state_t)1 << layer1) | ((layer_state_t)1 << layer2); - layer_state_t mask3 = (layer_state_t)1 << layer3; - return (state & mask12) == mask12 ? (state | mask3) : (state & ~mask3); -} - -void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3) { - layer_state_set(update_tri_layer_state(layer_state, layer1, layer2, layer3)); -} - -// TODO: remove legacy api -void matrix_init_quantum() { - matrix_init_kb(); -} -void matrix_scan_quantum() { - matrix_scan_kb(); -} - //------------------------------------------------------------------------------ // Override these functions in your keymap file to play different tunes on // different events such as startup and bootloader jump -__attribute__((weak)) void startup_user() {} +__attribute__((weak)) void startup_user(void) {} -__attribute__((weak)) void shutdown_user() {} +__attribute__((weak)) void shutdown_user(void) {} void suspend_power_down_quantum(void) { suspend_power_down_kb(); |