From 12dc7f583ad853009c2a95e6d06fe3f4e2d8c3d9 Mon Sep 17 00:00:00 2001 From: Nulo Date: Thu, 17 Feb 2022 20:51:54 -0300 Subject: [PATCH] Revert "Callum based" This reverts commit b0a699c24dedb15f816b4072eafdbb74f2dfc699. --- keyboards/atreus/config.h | 7 ++ keyboards/atreus/keymaps/default/keymap.c | 126 ++++++--------------- keyboards/atreus/keymaps/default/oneshot.c | 57 ---------- keyboards/atreus/keymaps/default/oneshot.h | 31 ----- keyboards/atreus/keymaps/default/rules.mk | 3 - 5 files changed, 39 insertions(+), 185 deletions(-) delete mode 100644 keyboards/atreus/keymaps/default/oneshot.c delete mode 100644 keyboards/atreus/keymaps/default/oneshot.h delete mode 100644 keyboards/atreus/keymaps/default/rules.mk diff --git a/keyboards/atreus/config.h b/keyboards/atreus/config.h index 3d863c825e..6f9b9826bd 100644 --- a/keyboards/atreus/config.h +++ b/keyboards/atreus/config.h @@ -44,6 +44,13 @@ /* Locking resynchronize hack */ //#define LOCKING_RESYNC_ENABLE +#undef TAPPING_TERM +#define TAPPING_TERM 170 +#define TAPPING_FORCE_HOLD +#define TAPPING_FORCE_HOLD_PER_KEY +#define IGNORE_MOD_TAP_INTERRUPT +#define PERMISSIVE_HOLD + /* * Feature disable options * These options are also useful to firmware size reduction. diff --git a/keyboards/atreus/keymaps/default/keymap.c b/keyboards/atreus/keymaps/default/keymap.c index bd75ac48b9..b63c399dd2 100644 --- a/keyboards/atreus/keymaps/default/keymap.c +++ b/keyboards/atreus/keymaps/default/keymap.c @@ -1,106 +1,44 @@ +// this is the style you want to emulate. +// This is the canonical layout file for the Quantum project. If you want to add another keyboard, + #include QMK_KEYBOARD_H -#include "oneshot.h" +#define RALT_A RALT_T(KC_A) +#define ALT_S LALT_T(KC_S) +#define CTL_D LCTL_T(KC_D) +#define GUI_F LGUI_T(KC_F) -#define LA_SYM MO(SYM) -#define LA_NAV MO(NAV) +#define GUI_J LGUI_T(KC_J) +#define CTL_K LCTL_T(KC_K) +#define ALT_L LALT_T(KC_L) +#define RALT_SCLN RALT_T(KC_SCLN) -enum layers { - DEF, - SYM, - NAV, - NUM, -}; - -enum keycodes { - // Custom oneshot mod implementation with no timers. - OS_SHFT = SAFE_RANGE, - OS_CTRL, - OS_ALT, - OS_CMD, -}; +#define I_SPC LT(1, KC_SPC) const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [DEF] = LAYOUT( - KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, - KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, - KC_Z, KC_X, KC_C, KC_V, KC_B, XXXXXXX,XXXXXXX,KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, - XXXXXXX,XXXXXXX,XXXXXXX,LA_NAV, KC_BSPC,XXXXXXX,XXXXXXX,KC_SPC, LA_SYM, XXXXXXX,XXXXXXX,XXXXXXX - ), + [0] = LAYOUT( + KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P , + RALT_A, ALT_S, CTL_D, GUI_F, KC_G, KC_H, GUI_J, CTL_K, ALT_L, RALT_SCLN, + KC_Z, KC_X, KC_C, KC_V, KC_B, KC_GRV, KC_BSLS, KC_N, KC_M, KC_COMM,KC_DOT,KC_SLSH , + KC_ESC, KC_TAB, XXXXXXX,KC_LSFT,KC_BSPC, XXXXXXX,XXXXXXX, I_SPC, XXXXXXX,KC_MINS,KC_QUOT,KC_ENT) , - [SYM] = LAYOUT( - KC_ESC, KC_LBRC,KC_LCBR,KC_LPRN,KC_TILD, KC_CIRC,KC_RPRN,KC_RCBR,KC_RBRC,KC_GRV, - KC_MINS,KC_ASTR,KC_EQL, KC_UNDS,KC_DLR, KC_HASH,OS_CMD, OS_ALT, OS_CTRL,OS_SHFT, - KC_PLUS,KC_PIPE,KC_AT, KC_SLSH,KC_PERC,XXXXXXX,XXXXXXX,XXXXXXX,KC_BSLS,KC_AMPR,KC_QUES,KC_EXLM, - XXXXXXX,XXXXXXX,XXXXXXX,_______,_______,XXXXXXX,XXXXXXX,_______,_______,XXXXXXX,XXXXXXX,XXXXXXX - ), + [1] = LAYOUT( + KC_EXLM,KC_AT, KC_UP, KC_DLR, KC_PERC, KC_PGUP,KC_7, KC_8, KC_9, KC_BSPC, + KC_LPRN,KC_LEFT,KC_DOWN,KC_RGHT,KC_RPRN, KC_PGDN,KC_4, KC_5, KC_6, _______, + KC_LBRC,KC_RBRC,KC_HASH,KC_LCBR,KC_RCBR, KC_CIRC,KC_AMPR, KC_ASTR,KC_1, KC_2, KC_3, KC_PLUS, + TO(2), KC_INS, _______,KC_LSFT,KC_BSPC, XXXXXXX,XXXXXXX, _______,_______,KC_DOT, KC_0, KC_EQL), - [NAV] = LAYOUT( - KC_TAB, XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX, RESET, KC_CAPS,XXXXXXX,XXXXXXX,RESET, - OS_SHFT,OS_CTRL,OS_ALT, OS_CMD, XXXXXXX, KC_LEFT,KC_DOWN,KC_UP, KC_RGHT,KC_BSPC, - XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,_______,_______,XXXXXXX,KC_PGDN,KC_PGUP,XXXXXXX,KC_ENT, - XXXXXXX,XXXXXXX,XXXXXXX,_______,_______,XXXXXXX,XXXXXXX,_______,_______,XXXXXXX,XXXXXXX,XXXXXXX - ), - - [NUM] = LAYOUT( - KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, - OS_SHFT,OS_CTRL,OS_ALT, OS_CMD, KC_F11, KC_F12, OS_CMD, OS_ALT, OS_CTRL,OS_SHFT, - KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______,_______,KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, - XXXXXXX,XXXXXXX,XXXXXXX,_______,_______,XXXXXXX,XXXXXXX,_______,_______,XXXXXXX,XXXXXXX,XXXXXXX - ) + [2] = LAYOUT( + KC_INS, KC_HOME,KC_UP, KC_END, KC_PGUP, KC_UP, KC_F7, KC_F8, KC_F9, KC_F10 , + KC_DEL, KC_LEFT,KC_DOWN,KC_RGHT,KC_PGDN, KC_DOWN,KC_F4, KC_F5, KC_F6, KC_F11 , + KC_NO, KC_VOLU,KC_NO, KC_NO, RESET, _______,_______, KC_NO, KC_F1, KC_F2, KC_F3, KC_F12 , + TO(0), KC_VOLD,_______,KC_LSFT,KC_BSPC, XXXXXXX,XXXXXXX, _______,TO(0), KC_PSCR,KC_SLCK,KC_PAUS) }; -bool is_oneshot_cancel_key(uint16_t keycode) { - switch (keycode) { - case LA_SYM: - case LA_NAV: - return true; - default: - return false; - } -} - -bool is_oneshot_ignored_key(uint16_t keycode) { - switch (keycode) { - case LA_SYM: - case LA_NAV: - case KC_LSFT: - case OS_SHFT: - case OS_CTRL: - case OS_ALT: - case OS_CMD: - return true; - default: - return false; - } -} - -oneshot_state os_shft_state = os_up_unqueued; -oneshot_state os_ctrl_state = os_up_unqueued; -oneshot_state os_alt_state = os_up_unqueued; -oneshot_state os_cmd_state = os_up_unqueued; - -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - update_oneshot( - &os_shft_state, KC_LSFT, OS_SHFT, - keycode, record - ); - update_oneshot( - &os_ctrl_state, KC_LCTL, OS_CTRL, - keycode, record - ); - update_oneshot( - &os_alt_state, KC_LALT, OS_ALT, - keycode, record - ); - update_oneshot( - &os_cmd_state, KC_LCMD, OS_CMD, - keycode, record - ); - +bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) { return true; -} - -layer_state_t layer_state_set_user(layer_state_t state) { - return update_tri_layer_state(state, SYM, NAV, NUM); + switch (keycode) { + default: + return false; + } } diff --git a/keyboards/atreus/keymaps/default/oneshot.c b/keyboards/atreus/keymaps/default/oneshot.c deleted file mode 100644 index 33ec3895e2..0000000000 --- a/keyboards/atreus/keymaps/default/oneshot.c +++ /dev/null @@ -1,57 +0,0 @@ -#include "oneshot.h" - -void update_oneshot( - oneshot_state *state, - uint16_t mod, - uint16_t trigger, - uint16_t keycode, - keyrecord_t *record -) { - if (keycode == trigger) { - if (record->event.pressed) { - // Trigger keydown - if (*state == os_up_unqueued) { - register_code(mod); - } - *state = os_down_unused; - } else { - // Trigger keyup - switch (*state) { - case os_down_unused: - // If we didn't use the mod while trigger was held, queue it. - *state = os_up_queued; - break; - case os_down_used: - // If we did use the mod while trigger was held, unregister it. - *state = os_up_unqueued; - unregister_code(mod); - break; - default: - break; - } - } - } else { - if (record->event.pressed) { - if (is_oneshot_cancel_key(keycode) && *state != os_up_unqueued) { - // Cancel oneshot on designated cancel keydown. - *state = os_up_unqueued; - unregister_code(mod); - } - } else { - if (!is_oneshot_ignored_key(keycode)) { - // On non-ignored keyup, consider the oneshot used. - switch (*state) { - case os_down_unused: - *state = os_down_used; - break; - case os_up_queued: - *state = os_up_unqueued; - unregister_code(mod); - break; - default: - break; - } - } - } - } -} diff --git a/keyboards/atreus/keymaps/default/oneshot.h b/keyboards/atreus/keymaps/default/oneshot.h deleted file mode 100644 index a6b8e17742..0000000000 --- a/keyboards/atreus/keymaps/default/oneshot.h +++ /dev/null @@ -1,31 +0,0 @@ -#pragma once - -#include QMK_KEYBOARD_H - -// Represents the four states a oneshot key can be in -typedef enum { - os_up_unqueued, - os_up_queued, - os_down_unused, - os_down_used, -} oneshot_state; - -// Custom oneshot mod implementation that doesn't rely on timers. If a mod is -// used while it is held it will be unregistered on keyup as normal, otherwise -// it will be queued and only released after the next non-mod keyup. -void update_oneshot( - oneshot_state *state, - uint16_t mod, - uint16_t trigger, - uint16_t keycode, - keyrecord_t *record -); - -// To be implemented by the consumer. Defines keys to cancel oneshot mods. -bool is_oneshot_cancel_key(uint16_t keycode); - -// To be implemented by the consumer. Defines keys to ignore when determining -// whether a oneshot mod has been used. Setting this to modifiers and layer -// change keys allows stacking multiple oneshot modifiers, and carrying them -// between layers. -bool is_oneshot_ignored_key(uint16_t keycode); diff --git a/keyboards/atreus/keymaps/default/rules.mk b/keyboards/atreus/keymaps/default/rules.mk deleted file mode 100644 index 7e6b03dc60..0000000000 --- a/keyboards/atreus/keymaps/default/rules.mk +++ /dev/null @@ -1,3 +0,0 @@ -RGBLIGHT_ENABLE = no - -SRC += oneshot.c