make corne work
This commit is contained in:
parent
49eaad0121
commit
b6d872e3e2
|
@ -2,3 +2,4 @@
|
|||
path = qmk_firmware
|
||||
url = git@github.com:qmk/qmk_firmware.git
|
||||
ignore = dirty
|
||||
branch = master
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
COMB(TN_CW, CW_TOGG, T_LSFT, N_RSFT)
|
|
@ -1,3 +1 @@
|
|||
#pragma once
|
||||
|
||||
#define UNICODE_SELECTED_MODES UNICODE_MODE_WINCOMPOSE
|
||||
#pragma once
|
|
@ -1,6 +1,9 @@
|
|||
#pragma once
|
||||
|
||||
#include QMK_KEYBOARD_H
|
||||
#include "keymap_us_international.h"
|
||||
#include "sendstring_us_international.h"
|
||||
|
||||
#include "layers.h"
|
||||
#include "quantum.h"
|
||||
|
||||
|
@ -8,6 +11,10 @@ enum custom_keycodes {
|
|||
DIRUP = SAFE_RANGE,
|
||||
NEQ,
|
||||
COLNEQ,
|
||||
TILDE, // ~
|
||||
BKTK, // `
|
||||
CIRC, // ^
|
||||
QUOT, // '
|
||||
};
|
||||
|
||||
// Home row mods
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#pragma once
|
||||
|
||||
enum layers {
|
||||
BAS, // base
|
||||
SYM, // symbols
|
||||
NUM, // numbers
|
||||
FUN, // function keys
|
||||
NAV, // navigation
|
||||
OPS, // operators
|
||||
MED, // media controls
|
||||
GAM, // gaming
|
||||
BAS, // Base
|
||||
SYM, // Symbols
|
||||
NUM, // Numbers
|
||||
FUN, // Function keys
|
||||
NAV, // Navigation
|
||||
OPS, // Operators
|
||||
MED, // Media controls
|
||||
GAM, // Gaming
|
||||
};
|
||||
|
|
|
@ -5,22 +5,22 @@
|
|||
#include "keyboard.h"
|
||||
#include "keycodes.h"
|
||||
#include "keymap_us.h"
|
||||
#include "keymap_us_international.h"
|
||||
#include "layers.h"
|
||||
#include "quantum_keycodes.h"
|
||||
|
||||
// clang-format off
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
/*
|
||||
* q w f p b j l u y '
|
||||
* a r s t g m n e i o
|
||||
* z x c d v k h , . :
|
||||
* q w f p b j l u y ' å
|
||||
* a r s t g m n e i o ä
|
||||
* z x c d v k h , . : ö
|
||||
*/
|
||||
[BAS] = LAYOUT(
|
||||
KC_DEL, KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_QUOT, U_AO,
|
||||
KC_ESC, A_LGUI, R_LALT, S_NUM, T_LSFT, KC_G, KC_M, N_RSFT, E_OPS, I_RALT, O_RGUI, U_AE,
|
||||
_______, KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_COLN, U_OE,
|
||||
[BAS] = LAYOUT_split_3x6_3(
|
||||
KC_DEL, KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, QUOT, US_ARNG,
|
||||
KC_ESC, A_LGUI, R_LALT, S_NUM, T_LSFT, KC_G, KC_M, N_RSFT, E_OPS, I_RALT, O_RGUI, US_ADIA,
|
||||
_______, KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_COLN, US_ODIA,
|
||||
KC_LALT, BSP_NAV, TAB_LCT, ENT_RCT, SPC_SYM, _______
|
||||
|
||||
),
|
||||
};
|
||||
// clang-format on
|
||||
|
|
|
@ -5,13 +5,21 @@
|
|||
#include "modifiers.h"
|
||||
#include "timer.h"
|
||||
|
||||
const custom_shift_key_t custom_shift_keys[] = {
|
||||
{KC_DOT, KC_QUES},
|
||||
{KC_COMM, KC_EXLM},
|
||||
{KC_COLN, KC_SCLN},
|
||||
const key_override_t dot_key_override =
|
||||
ko_make_basic(MOD_MASK_SHIFT, KC_DOT, KC_QUES);
|
||||
const key_override_t comm_key_override =
|
||||
ko_make_basic(MOD_MASK_SHIFT, KC_COMM, KC_EXLM);
|
||||
const key_override_t coln_key_override =
|
||||
ko_make_basic(MOD_MASK_SHIFT, KC_COLN, KC_SCLN);
|
||||
|
||||
// clang-format off
|
||||
const key_override_t** key_overrides = (const key_override_t*[]) {
|
||||
&dot_key_override,
|
||||
&comm_key_override,
|
||||
&coln_key_override,
|
||||
NULL
|
||||
};
|
||||
uint8_t NUM_CUSTOM_SHIFT_KEYS =
|
||||
sizeof(custom_shift_keys) / sizeof(custom_shift_key_t);
|
||||
// clang-format on
|
||||
|
||||
#include "g/keymap_combo.h"
|
||||
|
||||
|
@ -31,8 +39,6 @@ void keyboard_pre_init_user(void) {
|
|||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
if (!process_achordion(keycode, record))
|
||||
return false;
|
||||
if (!process_custom_shift_keys(keycode, record))
|
||||
return false;
|
||||
|
||||
switch (keycode) {
|
||||
case DIRUP:
|
||||
|
@ -53,6 +59,30 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
return false;
|
||||
}
|
||||
break;
|
||||
case TILDE:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING("~");
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case BKTK:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING("`");
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case CIRC:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING("^");
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case QUOT:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING("'");
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -43,9 +43,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
* ~ @ [ ]
|
||||
*/
|
||||
[SYM] = LAYOUT(
|
||||
BKTK, KC_DLR, KC_LCBR, KC_RCBR, _______, _______, _______, _______, _______, _______,
|
||||
BKTK, KC_DLR, KC_LCBR, KC_RCBR, KC_QUOT, _______, _______, _______, _______, _______,
|
||||
KC_HASH, KC_UNDS, KC_LPRN, KC_RPRN, _______, _______, _______, _______, _______, _______,
|
||||
TILDE, KC_AT, KC_LBRC, KC_RBRC, _______, _______, _______, _______, _______, _______,
|
||||
TILDE, KC_AT, KC_LBRC, KC_RBRC, KC_TILDE, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______
|
||||
),
|
||||
|
||||
|
@ -77,7 +77,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
),
|
||||
|
||||
[NAV] = LAYOUT(
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, TG(GAM), _______, _______, _______, _______,
|
||||
TAB_PRV, _______, _______, _______, _______, TG(SWE), KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT,
|
||||
TAB_NXT, _______, _______, _______, _______, _______, TAB_PRV, KC_PGDN, KC_PGUP, TAB_NXT,
|
||||
_______, _______, _______, _______
|
||||
|
@ -91,9 +91,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
),
|
||||
|
||||
[GAM] = LAYOUT(
|
||||
KC_ESC, KC_Q, KC_X, KC_E, _______, _______, _______, _______, _______, _______,
|
||||
KC_LSFT, KC_A, KC_W, KC_D, _______, _______, _______, _______, _______, _______,
|
||||
KC_LCTL, KC_Z, KC_S, KC_C, _______, _______, _______, _______, _______, _______,
|
||||
KC_ESC, KC_Q, KC_W, KC_E, TG(GAM), _______, _______, _______, _______, _______,
|
||||
KC_LSFT, KC_A, KC_S, KC_D, _______, _______, _______, _______, _______, _______,
|
||||
KC_LCTL, KC_Z, KC_X, KC_C, _______, _______, _______, _______, _______, _______,
|
||||
KC_SPC, KC_TAB, _______, _______
|
||||
),
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
VPATH += keyboards/gboards
|
||||
RGBLIGHT_ENABLE = yes
|
||||
CONVERT_TO=promicro_rp2040
|
||||
KEY_OVERRIDE_ENABLE = yes
|
||||
CONVERT_TO=promicro_rp2040
|
|
@ -1 +1 @@
|
|||
Subproject commit b68e89f8466d6b0f33543a34db84acdbae46f734
|
||||
Subproject commit 4e369d405af6bba1adce6337b2e1b1ea1788566c
|
|
@ -1,5 +1,4 @@
|
|||
#pragma once
|
||||
|
||||
#include QMK_KEYBOARD_H
|
||||
#include "features/achordion.h"
|
||||
// #include "definitions/unicode.h"
|
||||
|
||||
#include "features/achordion.h"
|
|
@ -1,36 +0,0 @@
|
|||
#pragma once
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
enum unicode_names {
|
||||
U_AE_LOWER,
|
||||
U_AE_UPPER,
|
||||
U_OE_LOWER,
|
||||
U_OE_UPPER,
|
||||
U_AO_LOWER,
|
||||
U_AO_UPPER,
|
||||
U_EACC_LOWER,
|
||||
U_EACC_UPPER,
|
||||
U_NTLD_LOWER,
|
||||
U_NTLD_UPPER,
|
||||
};
|
||||
|
||||
#define U_AE XP(U_AE_LOWER, U_AE_UPPER)
|
||||
#define U_OE XP(U_OE_LOWER, U_OE_UPPER)
|
||||
#define U_AO XP(U_AO_LOWER, U_AO_UPPER)
|
||||
#define U_EACC XP(U_EACC_LOWER, U_EACC_UPPER)
|
||||
#define U_NTLD XP(U_NTLD_LOWER, U_NTLD_UPPER)
|
||||
|
||||
// Code lookup tool
|
||||
// https://unicode.emnudge.dev/
|
||||
const uint32_t unicode_map[] PROGMEM = {
|
||||
[U_AE_LOWER] = 0x00e4, // ä
|
||||
[U_AE_UPPER] = 0x00c4, // Ä
|
||||
[U_OE_LOWER] = 0x00f6, // ö
|
||||
[U_OE_UPPER] = 0x00d6, // Ö
|
||||
[U_AO_LOWER] = 0x00e5, // å
|
||||
[U_AO_UPPER] = 0x00c5, // Å
|
||||
[U_EACC_LOWER] = 0x00e9, // é
|
||||
[U_EACC_UPPER] = 0x00c9, // É
|
||||
[U_NTLD_LOWER] = 0x00F1, // ñ
|
||||
[U_NTLD_UPPER] = 0x00D1, // Ñ
|
||||
};
|
|
@ -22,6 +22,12 @@
|
|||
|
||||
#include "achordion.h"
|
||||
|
||||
#if !defined(IS_QK_MOD_TAP)
|
||||
// Attempt to detect out-of-date QMK installation, which would fail with
|
||||
// implicit-function-declaration errors in the code below.
|
||||
#error "achordion: QMK version is too old to build. Please update QMK."
|
||||
#else
|
||||
|
||||
// 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;
|
||||
|
@ -29,6 +35,16 @@ static uint16_t tap_hold_keycode = KC_NO;
|
|||
static uint16_t hold_timer = 0;
|
||||
// Eagerly applied mods, if any.
|
||||
static uint8_t eager_mods = 0;
|
||||
// Flag to determine whether another key is pressed within the timeout.
|
||||
static bool pressed_another_key_before_release = false;
|
||||
|
||||
#ifdef ACHORDION_STREAK
|
||||
// Timer for typing streak
|
||||
static uint16_t streak_timer = 0;
|
||||
#else
|
||||
// When disabled, is_streak is never true
|
||||
#define is_streak false
|
||||
#endif
|
||||
|
||||
// Achordion's current state.
|
||||
enum {
|
||||
|
@ -73,6 +89,14 @@ bool process_achordion(uint16_t keycode, keyrecord_t* record) {
|
|||
return true;
|
||||
}
|
||||
|
||||
// If this is a keypress and if the key is different than the tap-hold key,
|
||||
// this information is saved to a flag to be processed later when the tap-hold
|
||||
// key is released.
|
||||
if (!pressed_another_key_before_release && record->event.pressed &&
|
||||
tap_hold_keycode != KC_NO && tap_hold_keycode != keycode) {
|
||||
pressed_another_key_before_release = 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);
|
||||
|
@ -80,8 +104,8 @@ bool process_achordion(uint16_t keycode, keyrecord_t* record) {
|
|||
#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);
|
||||
const bool is_key_event =
|
||||
(record->event.key.row < 254 && record->event.key.col < 254);
|
||||
#endif
|
||||
|
||||
if (achordion_state == STATE_RELEASED) {
|
||||
|
@ -110,6 +134,9 @@ bool process_achordion(uint16_t keycode, keyrecord_t* record) {
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef ACHORDION_STREAK
|
||||
streak_timer = (timer_read() + achordion_streak_timeout(keycode)) | 1;
|
||||
#endif
|
||||
return true; // Otherwise, continue with default handling.
|
||||
}
|
||||
|
||||
|
@ -120,6 +147,15 @@ bool process_achordion(uint16_t keycode, keyrecord_t* record) {
|
|||
tap_hold_record.event.pressed = false;
|
||||
// Plumb hold release event.
|
||||
recursively_process_record(&tap_hold_record, STATE_RELEASED);
|
||||
} else if (!pressed_another_key_before_release) {
|
||||
// No other key was pressed between the press and release of the tap-hold
|
||||
// key, simulate a hold and then a release without waiting for Achordion
|
||||
// timeout to end.
|
||||
dprintln("Achordion: Key released. Simulating hold and release.");
|
||||
settle_as_hold();
|
||||
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." : "");
|
||||
|
@ -129,10 +165,18 @@ bool process_achordion(uint16_t keycode, keyrecord_t* record) {
|
|||
}
|
||||
|
||||
achordion_state = STATE_RELEASED;
|
||||
// The tap-hold key is released, clear the related keycode and the flag.
|
||||
tap_hold_keycode = KC_NO;
|
||||
pressed_another_key_before_release = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (achordion_state == STATE_UNSETTLED && record->event.pressed) {
|
||||
#ifdef ACHORDION_STREAK
|
||||
const bool is_streak = (streak_timer != 0);
|
||||
streak_timer = (timer_read() + achordion_streak_timeout(keycode)) | 1;
|
||||
#endif
|
||||
|
||||
// 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
|
||||
|
@ -145,10 +189,21 @@ bool process_achordion(uint16_t keycode, keyrecord_t* record) {
|
|||
// 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)) {
|
||||
if (!is_streak && (!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();
|
||||
|
||||
#ifdef REPEAT_KEY_ENABLE
|
||||
// Edge case involving LT + Repeat Key: in a sequence of "LT down, other
|
||||
// down" where "other" is on the other layer in the same position as
|
||||
// Repeat or Alternate Repeat, the repeated keycode is set instead of the
|
||||
// the one on the switched-to layer. Here we correct that.
|
||||
if (get_repeat_key_count() != 0 && IS_QK_LAYER_TAP(tap_hold_keycode)) {
|
||||
record->keycode = KC_NO; // Forget the repeated keycode.
|
||||
clear_weak_mods();
|
||||
}
|
||||
#endif // REPEAT_KEY_ENABLE
|
||||
} else {
|
||||
clear_eager_mods(); // Clear in case eager mods were set.
|
||||
|
||||
|
@ -173,6 +228,10 @@ bool process_achordion(uint16_t keycode, keyrecord_t* record) {
|
|||
return false; // Block the original event.
|
||||
}
|
||||
|
||||
#ifdef ACHORDION_STREAK
|
||||
// update idle timer on regular keys event
|
||||
streak_timer = (timer_read() + achordion_streak_timeout(keycode)) | 1;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -182,6 +241,12 @@ void achordion_task(void) {
|
|||
dprintln("Achordion: Timeout. Plumbing hold press.");
|
||||
settle_as_hold(); // Timeout expired, settle the key as held.
|
||||
}
|
||||
|
||||
#ifdef ACHORDION_STREAK
|
||||
if (streak_timer && timer_expired(timer_read(), streak_timer)) {
|
||||
streak_timer = 0; // Expired.
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Returns true if `pos` on the left hand of the keyboard, false if right.
|
||||
|
@ -218,3 +283,11 @@ __attribute__((weak)) uint16_t achordion_timeout(uint16_t tap_hold_keycode) {
|
|||
__attribute__((weak)) bool achordion_eager_mod(uint8_t mod) {
|
||||
return (mod & (MOD_LALT | MOD_LGUI)) == 0;
|
||||
}
|
||||
|
||||
#ifdef ACHORDION_STREAK
|
||||
__attribute__((weak)) uint16_t achordion_streak_timeout(uint16_t tap_hold_keycode) {
|
||||
return 100; // Default of 100 ms.
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // version check
|
||||
|
|
|
@ -53,6 +53,27 @@
|
|||
|
||||
#include "quantum.h"
|
||||
|
||||
/**
|
||||
* Suppress tap-hold mods within a *typing streak* by defining
|
||||
* ACHORDION_STREAK. This can help preventing accidental mod
|
||||
* activation when performing a fast tapping sequence.
|
||||
* This is inspired by https://sunaku.github.io/home-row-mods.html#typing-streaks
|
||||
*
|
||||
* Enable with:
|
||||
*
|
||||
* #define ACHORDION_STREAK
|
||||
*
|
||||
* Adjust the maximum time between key events before modifiers can be enabled
|
||||
* by defining the following callback in your keymap.c:
|
||||
*
|
||||
* uint16_t achordion_streak_timeout(uint16_t tap_hold_keycode) {
|
||||
* return 100; // Default of 100 ms.
|
||||
* }
|
||||
*/
|
||||
#ifdef ACHORDION_STREAK
|
||||
uint16_t achordion_streak_timeout(uint16_t tap_hold_keycode);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
@ -2,6 +2,7 @@ SRC += features/achordion.c
|
|||
COMBO_ENABLE = yes
|
||||
CAPS_WORD_ENABLE = yes
|
||||
NKRO_ENABLE = yes
|
||||
KEY_OVERRIDE_ENABLE = yes
|
||||
|
||||
# UNICODEMAP_ENABLE = yes
|
||||
# VPATH += keyboards/gboards doesn't work from userspace for some reason?
|
Loading…
Reference in New Issue