update config to current qmk

This commit is contained in:
Christoph Cullmann 2023-03-25 10:59:34 +01:00
parent af5e252f24
commit 8a894933e0
9 changed files with 36 additions and 118 deletions

View file

@ -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;
}

View file

@ -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 <https://docs.qmk.fm/#/mod_tap>.
*
* @param mod Modifier `MOD_` code.
* @return True if the modifier should be eagerly applied.

View file

@ -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

View file

@ -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,\

View file

@ -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

View file

@ -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;
}

View file

@ -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 <https://docs.qmk.fm/#/mod_tap>.
*
* @param mod Modifier `MOD_` code.
* @return True if the modifier should be eagerly applied.

View file

@ -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

View file

@ -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