From 8a894933e0e4f6d000fcf07ecb9b17521483afea Mon Sep 17 00:00:00 2001 From: Christoph Cullmann Date: Sat, 25 Mar 2023 10:59:34 +0100 Subject: update config to current qmk --- planck/achordion.c | 26 ++++++++------------------ planck/achordion.h | 19 ++++++------------- planck/config.h | 16 +--------------- planck/rules.mk | 3 +++ 4 files changed, 18 insertions(+), 46 deletions(-) (limited to 'planck') diff --git a/planck/achordion.c b/planck/achordion.c index 9c139f2..a11e7a9 100644 --- a/planck/achordion.c +++ b/planck/achordion.c @@ -1,4 +1,4 @@ -// Copyright 2022 Google LLC +// Copyright 2022-2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -74,12 +74,11 @@ bool process_achordion(uint16_t keycode, keyrecord_t* record) { } // Determine whether the current event is for a mod-tap or layer-tap key. - const bool is_mt = QK_MOD_TAP <= keycode && keycode <= QK_MOD_TAP_MAX; - const bool is_tap_hold = - is_mt || (QK_LAYER_TAP <= keycode && keycode <= QK_LAYER_TAP_MAX); + const bool is_mt = IS_QK_MOD_TAP(keycode); + const bool is_tap_hold = is_mt || IS_QK_LAYER_TAP(keycode); // Check key position to avoid acting on combos. - const bool is_physical_pos = - (record->event.key.row < 254 && record->event.key.col < 254); + const bool is_physical_pos = (record->event.key.row < KEYLOC_COMBO && + record->event.key.col < KEYLOC_COMBO); if (achordion_state == STATE_RELEASED) { if (is_tap_hold && record->tap.count == 0 && record->event.pressed && @@ -94,7 +93,7 @@ bool process_achordion(uint16_t keycode, keyrecord_t* record) { hold_timer = record->event.time + timeout; if (is_mt) { // Apply mods immediately if they are "eager." - uint8_t mod = (tap_hold_keycode >> 8) & 0x1f; + uint8_t mod = mod_config(QK_MOD_TAP_GET_MODS(tap_hold_keycode)); if (achordion_eager_mod(mod)) { eager_mods = ((mod & 0x10) == 0) ? mod : (mod << 4); register_mods(eager_mods); @@ -210,16 +209,7 @@ __attribute__((weak)) uint16_t achordion_timeout(uint16_t tap_hold_keycode) { return 1000; } -// By default, hold Shift and Ctrl mods eagerly. +// By default, Shift and Ctrl mods are eager, and Alt and GUI are not. __attribute__((weak)) bool achordion_eager_mod(uint8_t mod) { - switch (mod) { - case MOD_LSFT: - case MOD_RSFT: - case MOD_LCTL: - case MOD_RCTL: - return true; - - default: - return false; - } + return (mod & (MOD_LALT | MOD_LGUI)) == 0; } diff --git a/planck/achordion.h b/planck/achordion.h index 2968bdc..e6bb534 100644 --- a/planck/achordion.h +++ b/planck/achordion.h @@ -1,4 +1,4 @@ -// Copyright 2022 Google LLC +// Copyright 2022-2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -134,22 +134,15 @@ uint16_t achordion_timeout(uint16_t tap_hold_keycode); * key is still being settled. This is helpful to reduce delay particularly when * using mod-tap keys with an external mouse. * - * Define this callback in your keymap.c. The default callback is + * Define this callback in your keymap.c. The default callback is eager for + * Shift and Ctrl, and not for Alt and GUI: * * bool achordion_eager_mod(uint8_t mod) { - * switch (mod) { - * case MOD_LSFT: - * case MOD_RSFT: - * case MOD_LCTL: - * case MOD_RCTL: - * return true; // Eagerly apply Shift and Ctrl mods. - * - * default: - * return false; - * } + * return (mod & (MOD_LALT | MOD_LGUI)) == 0; * } * - * @note `mod` should be compared with `MOD_` prefixed codes, not `KC_` codes. + * @note `mod` should be compared with `MOD_` prefixed codes, not `KC_` codes, + * described at . * * @param mod Modifier `MOD_` code. * @return True if the modifier should be eagerly applied. diff --git a/planck/config.h b/planck/config.h index 350e343..5d5d997 100644 --- a/planck/config.h +++ b/planck/config.h @@ -30,7 +30,7 @@ #define IGNORE_MOD_TAP_INTERRUPT // Enable rapid switch from tap to hold, disables double tap hold auto-repeat. -#define TAPPING_FORCE_HOLD +#define QUICK_TAP_TERM 0 // try to be more permissive with holds, allows to trigger modifiers faster // achordion will avoid the worst @@ -73,17 +73,3 @@ // we want to have different backlight per layers #define RGBLIGHT_LAYERS - -// -// remove some features we don't need -// - -// not more than 8 layers -#define LAYER_STATE_8BIT - -// we don't need locking -#undef LOCKING_SUPPORT_ENABLE -#undef LOCKING_RESYNC_ENABLE - -// we don't use one shot keys -#define NO_ACTION_ONESHOT diff --git a/planck/rules.mk b/planck/rules.mk index 9c19aa4..108f55a 100644 --- a/planck/rules.mk +++ b/planck/rules.mk @@ -18,3 +18,6 @@ CAPS_WORD_ENABLE = yes # add achordion to improve home row modifiers SRC += achordion.c + +# per key debounce: https://github.com/qmk/qmk_firmware/blob/master/docs/feature_debounce_type.md +DEBOUNCE_TYPE = sym_defer_pk -- cgit v1.2.3