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 --- ferris/achordion.c | 26 ++++++++------------------ ferris/achordion.h | 19 ++++++------------- ferris/config.h | 16 +--------------- ferris/keymap.c | 26 -------------------------- ferris/rules.mk | 3 +++ 5 files changed, 18 insertions(+), 72 deletions(-) (limited to 'ferris') diff --git a/ferris/achordion.c b/ferris/achordion.c index 9c139f2..a11e7a9 100644 --- a/ferris/achordion.c +++ b/ferris/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/ferris/achordion.h b/ferris/achordion.h index 2968bdc..e6bb534 100644 --- a/ferris/achordion.h +++ b/ferris/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/ferris/config.h b/ferris/config.h index 9d01909..ace550c 100644 --- a/ferris/config.h +++ b/ferris/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 @@ -38,17 +38,3 @@ // caps word is great for defines #define BOTH_SHIFTS_TURNS_ON_CAPS_WORD - -// -// 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/ferris/keymap.c b/ferris/keymap.c index 9c0c604..50f8fd1 100644 --- a/ferris/keymap.c +++ b/ferris/keymap.c @@ -36,32 +36,6 @@ void matrix_scan_user(void) achordion_task(); } -static bool planck_bottom_row(keypos_t pos) -{ - return pos.row % (MATRIX_ROWS / 2) == 3; -} - -// works only for rows 0-2 or 4-6 -static bool planck_on_left_hand(keypos_t pos) -{ - // planck is like a split keyboard, beside for the last row - return pos.row < MATRIX_ROWS / 2; -} - -bool achordion_chord(uint16_t tap_hold_keycode, - keyrecord_t* tap_hold_record, - uint16_t other_keycode, - keyrecord_t* other_record) -{ - // last row is special for the planck, just allow there everything - if (planck_bottom_row(tap_hold_record->event.key) || planck_bottom_row(other_record->event.key)) { - return true; - } - - // now both keys are in rows 0-2 or 4-6, there we can check the left hand with the simple helper - return planck_on_left_hand(tap_hold_record->event.key) != planck_on_left_hand(other_record->event.key); -} - // layout helper macro, we just use 34 keys #define LAYOUT_cullmann(\ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09,\ diff --git a/ferris/rules.mk b/ferris/rules.mk index 9c19aa4..108f55a 100644 --- a/ferris/rules.mk +++ b/ferris/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