back to achordion

better support of one hand rolls
This commit is contained in:
Christoph Cullmann 2024-12-20 22:41:24 +01:00
parent 0d8942571b
commit edf089efd7
No known key found for this signature in database
9 changed files with 666 additions and 15 deletions

View file

@ -12,14 +12,22 @@
// from its 10ms default to the 1ms minimum that USB 1.x (Full Speed) allows:
#define USB_POLLING_INTERVAL_MS 1
// many settings taken from https://github.com/getreuer/qmk-keymap
// don't confuse apps
#define TAP_CODE_DELAY 5
// home row mods
#define CHORDAL_HOLD
#define TAPPING_TERM 170
#define TAPPING_TERM_PER_KEY
#define PERMISSIVE_HOLD
#define TAPPING_TERM 175
// no auto repeat stuff
#define QUICK_TAP_TERM 0
// enable streak detection
#define ACHORDION_STREAK
// tranfer enough info for the stuff we render on the OLEDs
#define SPLIT_LAYER_STATE_ENABLE
#define SPLIT_LED_STATE_ENABLE

View file

@ -89,22 +89,62 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
};
char chordal_hold_handedness(keypos_t key)
{
// special handle thumb keys
if (key.row == 3 || key.row == 7) return '*';
return (key.row < MATRIX_ROWS / 2) ? 'L' : 'R';
// 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;
}
}
bool get_chordal_hold(uint16_t tap_hold_keycode, keyrecord_t* tap_hold_record,
uint16_t other_keycode, keyrecord_t* other_record) {
// Allow hold between any pair of mod-tap keys.
if (IS_QK_MOD_TAP(tap_hold_keycode) && IS_QK_MOD_TAP(other_keycode)) {
return true;
}
#include "features/achordion.h"
// Otherwise defer to the opposite hands rule.
return get_chordal_hold_default(tap_hold_record, other_record);
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 CC_NO_LED