From 88e81b81c989e85b65d6d4e770fdaad52a2b604d Mon Sep 17 00:00:00 2001 From: Christoph Cullmann Date: Sat, 9 Nov 2024 16:56:28 +0100 Subject: [PATCH] try to use https://github.com/qmk/qmk_firmware/pull/24560 --- common/config.h | 12 +--- common/keymap.h | 59 ------------------- .../crkbd/keymaps/christoph-cullmann/keymap.c | 5 +- .../keymaps/christoph-cullmann/keymap.c | 5 +- .../keymaps/christoph-cullmann/keymap.c | 5 +- 5 files changed, 8 insertions(+), 78 deletions(-) diff --git a/common/config.h b/common/config.h index 0bc5e11..618f511 100644 --- a/common/config.h +++ b/common/config.h @@ -20,22 +20,14 @@ // enable NKRO by default #define FORCE_NKRO -// many settings taken from https://github.com/getreuer/qmk-keymap - -// don't confuse apps -#define TAP_CODE_DELAY 5 - // home row mods -#define TAPPING_TERM 170 -#define TAPPING_TERM_PER_KEY +#define CHORDAL_HOLD #define PERMISSIVE_HOLD +#define TAPPING_TERM 250 // no auto repeat stuff #define QUICK_TAP_TERM 0 -// enable streak detection -#define ACHORDION_STREAK - // // underglow configuration // diff --git a/common/keymap.h b/common/keymap.h index 3a084fa..c9f11e3 100644 --- a/common/keymap.h +++ b/common/keymap.h @@ -89,65 +89,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; -// many settings taken from https://github.com/getreuer/qmk-keymap - -uint16_t get_tapping_term(uint16_t keycode, keyrecord_t* record) { - switch (keycode) { - // slower for slow fingers - case CC_N: - case CC_S: - case CC_E: - case CC_I: - return TAPPING_TERM + 15; - default: - return TAPPING_TERM; - } -} - -#include "features/achordion.h" - -bool process_record_user(uint16_t keycode, keyrecord_t* record) { - if (!process_achordion(keycode, record)) { return false; } - return true; -} - -void matrix_scan_user(void) { - achordion_task(); -} - -bool achordion_chord(uint16_t tap_hold_keycode, - keyrecord_t* tap_hold_record, - uint16_t other_keycode, - keyrecord_t* other_record) { - // follow the opposite hands rule. - return on_left_hand(tap_hold_record->event.key) != - on_left_hand(other_record->event.key); -} - - -uint16_t achordion_timeout(uint16_t tap_hold_keycode) { - switch (tap_hold_keycode) { - default: - return 800; // Use a timeout of 800 ms. - } -} - -uint16_t achordion_streak_chord_timeout( - uint16_t tap_hold_keycode, uint16_t next_keycode) { - // Disable streak detection on LT keys. - if (IS_QK_LAYER_TAP(tap_hold_keycode)) { - return 0; - } - - // Otherwise, tap_hold_keycode is a mod-tap key. - const uint8_t mod = mod_config(QK_MOD_TAP_GET_MODS(tap_hold_keycode)); - if ((mod & (MOD_LSFT | MOD_RSFT)) != 0) { - return 100; // A short streak timeout for Shift mod-tap keys. - } else { - return 220; // A longer timeout otherwise. - } -} - #ifndef NO_LED void keyboard_post_init_user(void) { diff --git a/keyboards/crkbd/keymaps/christoph-cullmann/keymap.c b/keyboards/crkbd/keymaps/christoph-cullmann/keymap.c index 49ed6b2..abce70b 100644 --- a/keyboards/crkbd/keymaps/christoph-cullmann/keymap.c +++ b/keyboards/crkbd/keymaps/christoph-cullmann/keymap.c @@ -5,10 +5,9 @@ #include QMK_KEYBOARD_H -// Returns true if `pos` on the left hand of the keyboard, false if right. -static bool on_left_hand(keypos_t pos) +char chordal_hold_handedness_user(keypos_t key) { - return pos.row < MATRIX_ROWS / 2; + return (key.row < MATRIX_ROWS / 2) ? 'L' : 'R'; } // layout helper macro, we just use 42 keys diff --git a/keyboards/ferris/keymaps/christoph-cullmann/keymap.c b/keyboards/ferris/keymaps/christoph-cullmann/keymap.c index 6adb918..4329c79 100644 --- a/keyboards/ferris/keymaps/christoph-cullmann/keymap.c +++ b/keyboards/ferris/keymaps/christoph-cullmann/keymap.c @@ -5,10 +5,9 @@ #include QMK_KEYBOARD_H -// Returns true if `pos` on the left hand of the keyboard, false if right. -static bool on_left_hand(keypos_t pos) +char chordal_hold_handedness_user(keypos_t key) { - return pos.row < MATRIX_ROWS / 2; + return (key.row < MATRIX_ROWS / 2) ? 'L' : 'R'; } // layout helper macro, we just use 42 keys diff --git a/keyboards/planck/keymaps/christoph-cullmann/keymap.c b/keyboards/planck/keymaps/christoph-cullmann/keymap.c index 51a961c..b276ac8 100644 --- a/keyboards/planck/keymaps/christoph-cullmann/keymap.c +++ b/keyboards/planck/keymaps/christoph-cullmann/keymap.c @@ -5,10 +5,9 @@ #include QMK_KEYBOARD_H -// Returns true if `pos` on the left hand of the keyboard, false if right. -static bool on_left_hand(keypos_t pos) +char chordal_hold_handedness_user(keypos_t key) { - return (pos.row < 3) || (pos.row == 3 && pos.col < 3) || (pos.row == 7 && pos.col > 2); + return ((key.row < 3) || (key.row == 3 && key.col < 3) || (key.row == 7 && key.col > 2)) ? 'L' : 'R'; } // layout helper macro, we just use 42 keys