From c5a1f32c34057d53ad7b2d7a35a449d8b32bf20f Mon Sep 17 00:00:00 2001 From: Christoph Cullmann Date: Sun, 11 Jun 2023 11:43:07 +0200 Subject: add new map to ferris --- ferris/achordion.c | 220 +++++++++++++++++++++++++++++++++++++++++ ferris/achordion.h | 164 ++++++++++++++++++++++++++++++ ferris/config.h | 29 ++++++ ferris/keymap.c | 105 +++++++++++--------- ferris/rules.mk | 12 ++- totem/keymaps/default/keymap.c | 2 +- 6 files changed, 483 insertions(+), 49 deletions(-) create mode 100644 ferris/achordion.c create mode 100644 ferris/achordion.h diff --git a/ferris/achordion.c b/ferris/achordion.c new file mode 100644 index 0000000..148ff1e --- /dev/null +++ b/ferris/achordion.c @@ -0,0 +1,220 @@ +// 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. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @file achordion.c + * @brief Achordion implementation + * + * For full documentation, see + * + */ + +#include "achordion.h" + +// Copy of the `record` and `keycode` args for the current active tap-hold key. +static keyrecord_t tap_hold_record; +static uint16_t tap_hold_keycode = KC_NO; +// Timeout timer. When it expires, the key is considered held. +static uint16_t hold_timer = 0; +// Eagerly applied mods, if any. +static uint8_t eager_mods = 0; + +// Achordion's current state. +enum { + // A tap-hold key is pressed, but hasn't yet been settled as tapped or held. + STATE_UNSETTLED, + // Achordion is inactive. + STATE_RELEASED, + // Active tap-hold key has been settled as tapped. + STATE_TAPPING, + // Active tap-hold key has been settled as held. + STATE_HOLDING, + // This state is set while calling `process_record()`, which will recursively + // call `process_achordion()`. This state is checked so that we don't process + // events generated by Achordion and potentially create an infinite loop. + STATE_RECURSING, +}; +static uint8_t achordion_state = STATE_RELEASED; + +// Calls `process_record()` with state set to RECURSING. +static void recursively_process_record(keyrecord_t* record, uint8_t state) { + achordion_state = STATE_RECURSING; + process_record(record); + achordion_state = state; +} + +// Clears eagerly-applied mods. +static void clear_eager_mods(void) { + unregister_mods(eager_mods); + eager_mods = 0; +} + +// Sends hold press event and settles the active tap-hold key as held. +static void settle_as_hold(void) { + clear_eager_mods(); + // Create hold press event. + recursively_process_record(&tap_hold_record, STATE_HOLDING); +} + +bool process_achordion(uint16_t keycode, keyrecord_t* record) { + // Don't process events that Achordion generated. + if (achordion_state == STATE_RECURSING) { + return true; + } + + // Determine whether the current event is for a mod-tap or layer-tap key. + const bool is_mt = IS_QK_MOD_TAP(keycode); + const bool is_tap_hold = is_mt || IS_QK_LAYER_TAP(keycode); + // Check that this is a normal key event, don't act on combos. +#ifdef IS_KEYEVENT + const bool is_key_event = IS_KEYEVENT(record->event); +#else + const bool is_key_event = (record->event.key.row < 254 && + record->event.key.col < 254); +#endif + + if (achordion_state == STATE_RELEASED) { + if (is_tap_hold && record->tap.count == 0 && record->event.pressed && + is_key_event) { + // A tap-hold key is pressed and considered by QMK as "held". + const uint16_t timeout = achordion_timeout(keycode); + if (timeout > 0) { + achordion_state = STATE_UNSETTLED; + // Save info about this key. + tap_hold_keycode = keycode; + tap_hold_record = *record; + hold_timer = record->event.time + timeout; + + if (is_mt) { // Apply mods immediately if they are "eager." + 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); + } + } + + dprintf("Achordion: Key 0x%04X pressed.%s\n", keycode, + eager_mods ? " Set eager mods." : ""); + return false; // Skip default handling. + } + } + + return true; // Otherwise, continue with default handling. + } + + if (keycode == tap_hold_keycode && !record->event.pressed) { + // The active tap-hold key is being released. + if (achordion_state == STATE_HOLDING) { + dprintln("Achordion: Key released. Plumbing hold release."); + tap_hold_record.event.pressed = false; + // Plumb hold release event. + recursively_process_record(&tap_hold_record, STATE_RELEASED); + } else { + dprintf("Achordion: Key released.%s\n", + eager_mods ? " Clearing eager mods." : ""); + if (is_mt) { + clear_eager_mods(); + } + } + + achordion_state = STATE_RELEASED; + return false; + } + + if (achordion_state == STATE_UNSETTLED && record->event.pressed) { + // Press event occurred on a key other than the active tap-hold key. + + // If the other key is *also* a tap-hold key and considered by QMK to be + // held, then we settle the active key as held. This way, things like + // chording multiple home row modifiers will work, but let's our logic + // consider simply a single tap-hold key as "active" at a time. + // + // Otherwise, we call `achordion_chord()` to determine whether to settle the + // tap-hold key as tapped vs. held. We implement the tap or hold by plumbing + // events back into the handling pipeline so that QMK features and other + // user code can see them. This is done by calling `process_record()`, which + // in turn calls most handlers including `process_record_user()`. + if (!is_key_event || (is_tap_hold && record->tap.count == 0) || + achordion_chord(tap_hold_keycode, &tap_hold_record, keycode, record)) { + dprintln("Achordion: Plumbing hold press."); + settle_as_hold(); + } else { + clear_eager_mods(); // Clear in case eager mods were set. + + dprintln("Achordion: Plumbing tap press."); + tap_hold_record.tap.count = 1; // Revise event as a tap. + tap_hold_record.tap.interrupted = true; + // Plumb tap press event. + recursively_process_record(&tap_hold_record, STATE_TAPPING); + + send_keyboard_report(); +#if TAP_CODE_DELAY > 0 + wait_ms(TAP_CODE_DELAY); +#endif // TAP_CODE_DELAY > 0 + + dprintln("Achordion: Plumbing tap release."); + tap_hold_record.event.pressed = false; + // Plumb tap release event. + recursively_process_record(&tap_hold_record, STATE_TAPPING); + } + + recursively_process_record(record, achordion_state); // Re-process event. + return false; // Block the original event. + } + + return true; +} + +void achordion_task(void) { + if (achordion_state == STATE_UNSETTLED && + timer_expired(timer_read(), hold_timer)) { + dprintln("Achordion: Timeout. Plumbing hold press."); + settle_as_hold(); // Timeout expired, settle the key as held. + } +} + +// Returns true if `pos` on the left hand of the keyboard, false if right. +static bool on_left_hand(keypos_t pos) { +#ifdef SPLIT_KEYBOARD + return pos.row < MATRIX_ROWS / 2; +#else + return (MATRIX_COLS > MATRIX_ROWS) ? pos.col < MATRIX_COLS / 2 + : pos.row < MATRIX_ROWS / 2; +#endif +} + +bool achordion_opposite_hands(const keyrecord_t* tap_hold_record, + const keyrecord_t* other_record) { + return on_left_hand(tap_hold_record->event.key) != + on_left_hand(other_record->event.key); +} + +// By default, use the BILATERAL_COMBINATIONS rule to consider the tap-hold key +// "held" only when it and the other key are on opposite hands. +__attribute__((weak)) bool achordion_chord(uint16_t tap_hold_keycode, + keyrecord_t* tap_hold_record, + uint16_t other_keycode, + keyrecord_t* other_record) { + return achordion_opposite_hands(tap_hold_record, other_record); +} + +// By default, the timeout is 1000 ms for all keys. +__attribute__((weak)) uint16_t achordion_timeout(uint16_t tap_hold_keycode) { + return 1000; +} + +// By default, Shift and Ctrl mods are eager, and Alt and GUI are not. +__attribute__((weak)) bool achordion_eager_mod(uint8_t mod) { + return (mod & (MOD_LALT | MOD_LGUI)) == 0; +} diff --git a/ferris/achordion.h b/ferris/achordion.h new file mode 100644 index 0000000..e6bb534 --- /dev/null +++ b/ferris/achordion.h @@ -0,0 +1,164 @@ +// 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. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @file achordion.h + * @brief Achordion: Customizing the tap-hold decision. + * + * Overview + * -------- + * + * This library customizes when tap-hold keys are considered held vs. tapped + * based on the next pressed key, like Manna Harbour's Bilateral Combinations or + * ZMK's positional hold. The library works on top of QMK's existing tap-hold + * implementation. You define mod-tap and layer-tap keys as usual and use + * Achordion to fine-tune the behavior. + * + * When QMK settles a tap-hold key as held, Achordion intercepts the event. + * Achordion then revises the event as a tap or passes it along as a hold: + * + * * Chord condition: On the next key press, a customizable `achordion_chord()` + * function is called, which takes the tap-hold key and the next key pressed + * as args. When the function returns true, the tap-hold key is settled as + * held, and otherwise as tapped. + * + * * Timeout: If no other key press occurs within a timeout, the tap-hold key + * is settled as held. This is customizable with `achordion_timeout()`. + * + * Achordion only changes the behavior when QMK considered the key held. It + * changes some would-be holds to taps, but no taps to holds. + * + * @note Some QMK features handle events before the point where Achordion can + * intercept them, particularly: Combos, Key Lock, and Dynamic Macros. It's + * still possible to use these features and Achordion in your keymap, but beware + * they might behave poorly when used simultaneously with tap-hold keys. + * + * + * For full documentation, see + * + */ + +#pragma once + +#include "quantum.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Handler function for Achordion. + * + * Call this function from `process_record_user()` as + * + * #include "features/achordion.h" + * + * bool process_record_user(uint16_t keycode, keyrecord_t* record) { + * if (!process_achordion(keycode, record)) { return false; } + * // Your macros... + * return true; + * } + */ +bool process_achordion(uint16_t keycode, keyrecord_t* record); + +/** + * Matrix task function for Achordion. + * + * Call this function from `matrix_scan_user()` as + * + * void matrix_scan_user(void) { + * achordion_task(); + * } + */ +void achordion_task(void); + +/** + * Optional callback to customize which key chords are considered "held". + * + * In your keymap.c, define the callback + * + * bool achordion_chord(uint16_t tap_hold_keycode, + * keyrecord_t* tap_hold_record, + * uint16_t other_keycode, + * keyrecord_t* other_record) { + * // Conditions... + * } + * + * This callback is called if while `tap_hold_keycode` is pressed, + * `other_keycode` is pressed. Return true if the tap-hold key should be + * considered held, or false to consider it tapped. + * + * @param tap_hold_keycode Keycode of the tap-hold key. + * @param tap_hold_record keyrecord_t from the tap-hold press event. + * @param other_keycode Keycode of the other key. + * @param other_record keyrecord_t from the other key's press event. + * @return True if the tap-hold key should be considered held. + */ +bool achordion_chord(uint16_t tap_hold_keycode, keyrecord_t* tap_hold_record, + uint16_t other_keycode, keyrecord_t* other_record); + +/** + * Optional callback to define a timeout duration per keycode. + * + * In your keymap.c, define the callback + * + * uint16_t achordion_timeout(uint16_t tap_hold_keycode) { + * // ... + * } + * + * The callback determines Achordion's timeout duration for `tap_hold_keycode` + * in units of milliseconds. The timeout be in the range 0 to 32767 ms (upper + * bound is due to 16-bit timer limitations). Use a timeout of 0 to bypass + * Achordion. + * + * @param tap_hold_keycode Keycode of the tap-hold key. + * @return Timeout duration in milliseconds in the range 0 to 32767. + */ +uint16_t achordion_timeout(uint16_t tap_hold_keycode); + +/** + * Optional callback defining which mods are "eagerly" applied. + * + * This callback defines which mods are "eagerly" applied while a mod-tap + * 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 eager for + * Shift and Ctrl, and not for Alt and GUI: + * + * bool achordion_eager_mod(uint8_t mod) { + * return (mod & (MOD_LALT | MOD_LGUI)) == 0; + * } + * + * @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. + */ +bool achordion_eager_mod(uint8_t mod); + +/** + * Returns true if the args come from keys on opposite hands. + * + * @param tap_hold_record keyrecord_t from the tap-hold key's event. + * @param other_record keyrecord_t from the other key's event. + * @return True if the keys are on opposite hands. + */ +bool achordion_opposite_hands(const keyrecord_t* tap_hold_record, + const keyrecord_t* other_record); + +#ifdef __cplusplus +} +#endif diff --git a/ferris/config.h b/ferris/config.h index f1fd6cd..1812395 100644 --- a/ferris/config.h +++ b/ferris/config.h @@ -16,6 +16,35 @@ #pragma once +// tapping this number of times holds the key until tapped once again, disabled via 0 +#define ONESHOT_TAP_TOGGLE 0 + +// time (in ms) before the one shot key is released +#define ONESHOT_TIMEOUT 3000 + // we don't have any lock switches #undef LOCKING_SUPPORT_ENABLE #undef LOCKING_RESYNC_ENABLE + +// enable NKRO by default +#define FORCE_NKRO + +// +// improve home row modifiers via achoridion +// + +// settings for home row modifiers +// details see https://precondition.github.io/home-row-mods + +// the default of 200 +#define TAPPING_TERM 200 + +// Enable rapid switch from tap to hold, disables double tap hold auto-repeat. +#define QUICK_TAP_TERM 0 + +// try to be more permissive with holds, allows to trigger modifiers faster +// achordion will avoid the worst +#define PERMISSIVE_HOLD + +// caps word is great for defines +#define BOTH_SHIFTS_TURNS_ON_CAPS_WORD diff --git a/ferris/keymap.c b/ferris/keymap.c index 0614131..2722f29 100644 --- a/ferris/keymap.c +++ b/ferris/keymap.c @@ -15,65 +15,78 @@ */ #include QMK_KEYBOARD_H +// ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +// │ D E F I N I T I O N S │ +// └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +// ▝▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▘ -// layout helper macro, we just use 34 keys -#define LAYOUT_cullmann(\ -K00, K01, K02, K03, K04, K05, K06, K07, K08, K09,\ -K10, K11, K12, K13, K14, K15, K16, K17, K18, K19,\ -K20, K21, K22, K23, K24, K25, K26, K27, K28, K29,\ - K30, K31, K32, K33\ -)\ -LAYOUT(\ -K00, K01, K02, K03, K04, K05, K06, K07, K08, K09,\ -K10, K11, K12, K13, K14, K15, K16, K17, K18, K19,\ -K20, K21, K22, K23, K24, K25, K26, K27, K28, K29,\ - K30, K31, K32, K33\ -) +// ┌─────────────────────────────────────────────────┐ +// │ d e f i n e l a y e r s │ +// └─────────────────────────────────────────────────┘ -// our layers, used as index in layers and rgb lights -enum planck_layers { - L_CANARY, - L_EXT, - L_SYM, - L_NUM, - L_FUN, +enum my_layers { + _QWERTY, + _SYM, + _NUM, + _FN, + _NAV }; +// ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +// │ K E Y M A P S │ +// └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +// ▝▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▘ + const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -[L_CANARY] = LAYOUT_cullmann( - KC_W, KC_L, KC_Y, KC_P, KC_B, KC_Z, KC_F, KC_O, KC_U, KC_QUOT, - KC_C, KC_R, KC_S, KC_T, KC_G, KC_M, KC_N, KC_E, KC_I, KC_A, - KC_Q, KC_J, KC_V, KC_D, KC_K, KC_X, KC_H, KC_SLSH, KC_COMM, KC_DOT, - MO(L_EXT), KC_SPC, KC_RSFT, MO(L_SYM) +[_QWERTY] = LAYOUT( + KC_W, KC_L, KC_Y, KC_P, KC_B, KC_Z, KC_F, KC_O, KC_U, KC_QUOT, + RALT_T(KC_C) , LALT_T(KC_R), LCTL_T(KC_S) , LSFT_T(KC_T) , LGUI_T(KC_G), RGUI_T(KC_M), RSFT_T(KC_N), RCTL_T(KC_E), LALT_T(KC_I) , RALT_T(KC_A), + KC_Q , KC_J, KC_V , KC_D , KC_K, KC_X, KC_H , KC_SLSH , KC_COMM, KC_DOT , + MO(_SYM), LT(_NUM, KC_SPC), LT(_NAV, KC_BSPC), MO(_FN) ), -[L_EXT] = LAYOUT_cullmann( - KC_ESC, LALT(KC_LEFT), LCTL(KC_F), LALT(KC_RGHT), KC_INS, KC_PGUP, KC_HOME, KC_UP, KC_END, KC_CAPS, - OSM(MOD_LALT), OSM(MOD_LGUI), OSM(MOD_LSFT), OSM(MOD_LCTL), OSM(MOD_RALT), KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, KC_DEL, - LCTL(KC_Z), LCTL(KC_X), LCTL(KC_C), KC_LGUI, LCTL(KC_V), KC_ENT, KC_BSPC, KC_TAB, KC_APP, KC_PSCR, - KC_TRNS, XXXXXXX, KC_ENT, MO(L_FUN) +[_SYM] = LAYOUT( + XXXXXXX, C(KC_X), C(KC_C), C(KC_V), XXXXXXX, KC_LCBR, KC_AMPR, KC_ASTR, KC_LPRN, KC_RCBR, + OSM(MOD_RALT), OSM(MOD_LALT), OSM(MOD_LCTL), OSM(MOD_LSFT), OSM(MOD_LGUI), KC_PLUS, KC_DLR, KC_PERC, KC_CIRC, KC_COLN, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_PIPE, KC_EXLM, KC_AT, KC_HASH, KC_TILD, + _______, _______, KC_UNDS, KC_RPRN ), -[L_SYM] = LAYOUT_cullmann( - KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_EQL, KC_GRV, KC_COLN, KC_SCLN, KC_PLUS, - OSM(MOD_LALT), OSM(MOD_LGUI), OSM(MOD_LSFT), OSM(MOD_LCTL), KC_CIRC, KC_ASTR, KC_LPRN, KC_LCBR, KC_LBRC, KC_MINS, - KC_NUBS, LSFT(KC_NUBS), KC_NUHS, LSFT(KC_NUHS), KC_AMPR, KC_TILD, KC_RPRN, KC_RCBR, KC_RBRC, KC_UNDS, - MO(L_FUN), MO(L_NUM), KC_ENT, KC_TRNS +[_NUM] = LAYOUT( + XXXXXXX, C(KC_X), C(KC_C), C(KC_V), XXXXXXX, KC_LBRC, KC_7, KC_8, KC_9, KC_RBRC, + OSM(MOD_RALT), OSM(MOD_LALT), OSM(MOD_LCTL), OSM(MOD_LSFT), OSM(MOD_LGUI), KC_EQL, KC_4, KC_5, KC_6, KC_SCLN, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_BSLS, KC_1, KC_2, KC_3, KC_GRV, + _______, _______, KC_MINS, KC_0 ), -[L_NUM] = LAYOUT_cullmann( - XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_NUM, KC_EQL, KC_7, KC_8, KC_9, KC_PLUS, - OSM(MOD_LALT), OSM(MOD_LGUI), OSM(MOD_LSFT), OSM(MOD_LCTL), OSM(MOD_RALT), KC_ASTR, KC_4, KC_5, KC_6, KC_MINS, - XXXXXXX, KC_APP, KC_TAB, KC_BSPC, KC_ENT, KC_0, KC_1, KC_2, KC_3, KC_SLSH, - MO(L_FUN), MO(L_NUM), KC_ENT, KC_TRNS +[_FN] = LAYOUT( + KC_F12, KC_F7, KC_F8, KC_F9, KC_PSCR, QK_BOOT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + KC_F11, KC_F4, KC_F5, KC_F6, KC_DEL, OSM(MOD_RGUI), OSM(MOD_RSFT), OSM(MOD_RCTL), OSM(MOD_LALT), OSM(MOD_RALT), + KC_F10, KC_F1, KC_F2, KC_F3, KC_INS, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + KC_BSPC, KC_ESC, _______, _______ ), -[L_FUN] = LAYOUT_cullmann( - KC_MSTP, KC_MPRV, KC_MPLY, KC_MNXT, KC_BRIU, KC_F12, KC_F7, KC_F8, KC_F9, QK_BOOT, - OSM(MOD_LALT), OSM(MOD_LGUI), OSM(MOD_LSFT), OSM(MOD_LCTL), KC_BRID, KC_F11, KC_F4, KC_F5, KC_F6, XXXXXXX, - KC_MUTE, KC_VOLD, RCS(KC_C), KC_VOLU, RCS(KC_V), KC_F10, KC_F1, KC_F2, KC_F3, XXXXXXX, - KC_TRNS, XXXXXXX, KC_ENT, KC_TRNS -), +[_NAV] = LAYOUT( + XXXXXXX, KC_PGUP, KC_UP, KC_PGDN, XXXXXXX, QK_BOOT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + KC_HOME, KC_LEFT, KC_DOWN, KC_RGHT, KC_END, OSM(MOD_RGUI), OSM(MOD_RSFT), OSM(MOD_RCTL), OSM(MOD_LALT), OSM(MOD_RALT), + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + KC_TAB, KC_ENT, _______, _______ +) }; + +// better handling of home row modifiers +// see https://getreuer.info/posts/keyboards/achordion/index.html + +#include "achordion.h" +#include "achordion.c" + +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(); +} diff --git a/ferris/rules.mk b/ferris/rules.mk index dd070e7..4cf4696 100644 --- a/ferris/rules.mk +++ b/ferris/rules.mk @@ -5,5 +5,13 @@ LTO_ENABLE = yes COMMAND_ENABLE = no CONSOLE_ENABLE = no -# per key debounce: https://github.com/qmk/qmk_firmware/blob/master/docs/feature_debounce_type.md -DEBOUNCE_TYPE = sym_defer_pk +# Enable N-Key Rollover +NKRO_ENABLE = yes + +# more responsive debouncing: https://michael.stapelberg.ch/posts/2021-05-08-keyboard-input-latency-qmk-kinesis/ +# sym_eager_pk does do some key chatter +DEBOUNCE_TYPE = asym_eager_defer_pk + +# build +# qmk compile -kb ferris/sweep -km christoph-cullmann +# qmk flash -kb ferris/sweep -km christoph-cullmann diff --git a/totem/keymaps/default/keymap.c b/totem/keymaps/default/keymap.c index 97486b4..e6e2dbe 100644 --- a/totem/keymaps/default/keymap.c +++ b/totem/keymaps/default/keymap.c @@ -24,7 +24,7 @@ // │ d e f i n e l a y e r s │ // └─────────────────────────────────────────────────┘ -enum totem_layers { +enum my_layers { _QWERTY, _SYM, _NUM, -- cgit v1.2.3