diff options
Diffstat (limited to 'qmk/keyboards/sofle_choc/keymaps')
-rw-r--r-- | qmk/keyboards/sofle_choc/keymaps/custom/config.h | 7 | ||||
-rw-r--r-- | qmk/keyboards/sofle_choc/keymaps/custom/keycodes.c | 27 | ||||
-rw-r--r-- | qmk/keyboards/sofle_choc/keymaps/custom/keycodes.h | 13 | ||||
-rw-r--r-- | qmk/keyboards/sofle_choc/keymaps/custom/keymap.c | 16 | ||||
-rw-r--r-- | qmk/keyboards/sofle_choc/keymaps/custom/quad_tapdance.c | 46 |
5 files changed, 56 insertions, 53 deletions
diff --git a/qmk/keyboards/sofle_choc/keymaps/custom/config.h b/qmk/keyboards/sofle_choc/keymaps/custom/config.h index 9a89fd8..6463554 100644 --- a/qmk/keyboards/sofle_choc/keymaps/custom/config.h +++ b/qmk/keyboards/sofle_choc/keymaps/custom/config.h @@ -35,11 +35,14 @@ #define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_LED D5 // Specify an optional status LED by GPIO number which blinks when entering the bootloader #define TAPPING_TERM 200 +#define TAPPING_TERM_PER_KEY -// Movihy the tap-hold configuration for helping with some tap-dance keys. +// Modify the tap-hold configuration for helping with some tap-dance keys. // The behavior with double-tap (like c/ç) and mod-tap is to wait the delay for // the tap-dance before reporting the key to send. // If I release the MOD-TAP key before, the modifier is not applied and the // host receive a sequence of two keys, which is not what I want. -//#define PERMISSIVE_HOLD +#define PERMISSIVE_HOLD //#define HOLD_ON_OTHER_KEY_PRESS + +#define COMBO_MUST_PRESS_IN_ORDER diff --git a/qmk/keyboards/sofle_choc/keymaps/custom/keycodes.c b/qmk/keyboards/sofle_choc/keymaps/custom/keycodes.c index e0f8994..020c3e6 100644 --- a/qmk/keyboards/sofle_choc/keymaps/custom/keycodes.c +++ b/qmk/keyboards/sofle_choc/keymaps/custom/keycodes.c @@ -76,3 +76,30 @@ const key_override_t **key_overrides = (const key_override_t *[]){ &e_key_override, NULL }; + +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case KEY_E: + return 230; + case LT_SFT: + return 250; + case KEY_EE: + return 350; + default: + return TAPPING_TERM; + } +} + + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case AL_ENT: + if (layer_state_is(LAYER_SYMBOLS) && !record->event.pressed) { + // Remove the layer the key is released. + layer_clear(); + } + return true; // Let QMK send the enter press/release events + default: + return true; // Process all other keycodes normally + } +} diff --git a/qmk/keyboards/sofle_choc/keymaps/custom/keycodes.h b/qmk/keyboards/sofle_choc/keymaps/custom/keycodes.h index 9837769..3919f4a 100644 --- a/qmk/keyboards/sofle_choc/keymaps/custom/keycodes.h +++ b/qmk/keyboards/sofle_choc/keymaps/custom/keycodes.h @@ -6,14 +6,17 @@ enum { // Transform the key W into SHIFT or CAPSLOCK TD_W_CAPSLOCK, // Transform the key E into È - TD_E_EE, + TD_EE, TD_PRC, TD_LAYER_SYMB, TD_LSFT, }; -#define _BASE 0 -#define LAYER_SYMBOLS 1 +enum { + LAYER_BASE, + LAYER_SYMBOLS + +}; #define MENU LGUI(BP_I) #define KEY_C TD(TD_C_CCED) @@ -22,7 +25,9 @@ enum { #define LT_SFT TD(TD_LSFT) #define AL_ENT MT(MOD_RALT, KC_ENT) #define AL_SPC MT(MOD_LALT, KC_SPC) -#define KEY_E TD(TD_E_EE) +//#define KEY_E TD(TD_E_EE) +#define KEY_E MT(MOD_LCTL, BP_E) +#define KEY_EE TD(TD_EE) #define KEY_T MT(MOD_RCTL, BP_T) #define KEY_INS MT(MOD_RGUI, KC_INS) diff --git a/qmk/keyboards/sofle_choc/keymaps/custom/keymap.c b/qmk/keyboards/sofle_choc/keymaps/custom/keymap.c index fb1ba89..292c45a 100644 --- a/qmk/keyboards/sofle_choc/keymaps/custom/keymap.c +++ b/qmk/keyboards/sofle_choc/keymaps/custom/keymap.c @@ -25,11 +25,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* * BÉPO * ,-----------------------------------------. ,-----------------------------------------. - * | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | ° | + * | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | `% | * |------+------+------+------+------+------| |------+------+------+------+------+------| * | ESC | B | É | P | O | È | | ! | V | D | L | J | Z | * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | Tab | A | U | I | EÈ | ; |-------. ,-------| CÇ | T | S | R | N | M | + * | Tab | A | U | I | E | ;È |-------. ,-------| CÇ | T | S | R | N | M | * |------+------+------+------+------+------| Mute | | Pause |------+------+------+------+------+------| * |LShift| À | Y | X | : | K |-------| |-------| ? | Q | G | H | F | W | * `-----------------------------------------/ / \ \-----------------------------------------' @@ -38,12 +38,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `-----------------------------------' '------''---------------------------' */ -[_BASE] = LAYOUT( +[LAYER_BASE] = LAYOUT( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KEY_PRC, BP_DLR, BP_B, BP_EACU, BP_P, BP_O, KC_BSPC, BP_DCIR, BP_V, BP_D, BP_L, BP_J, BP_Z, - KC_TAB, BP_A, BP_U, BP_I, KEY_E, BP_COMM, KEY_C, KEY_T, BP_S, BP_R, BP_N, BP_M, + KC_TAB, BP_A, BP_U, BP_I, KEY_E, KEY_EE, KEY_C, KEY_T, BP_S, BP_R, BP_N, BP_M, LT_SFT, BP_AGRV,BP_Y, BP_X, BP_DOT, KC_B, KC_MUTE, KC_MPLY,BP_QUOT, BP_Q, BP_G, BP_H, BP_F, KEY_W, - KC_LCTL, KC_LGUI, KC_BSPC, LY_SYMBOL,AL_SPC, AL_ENT, LY_SYMBOL,MENU, KEY_INS, KC_RCTL + KC_LCTL, KC_DELETE,KC_LGUI,LY_SYMBOL,AL_SPC, AL_ENT, LY_SYMBOL,MENU, KEY_INS, KC_RCTL ), // In the number layout, I keep the mod-tap modifiers applies to the middle letters : @@ -56,13 +56,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_NO, KC_NO, KC_NO, KC_P7, KC_P8, KC_P9, KC_HOME, KC_UP, KC_END, KC_NO, KC_NO, S(BP_EQL), KC_TAB, KC_NO, KC_NO, KC_P4, KEY_5, KC_P6, KC_LEFT, KEY_DOWN, KC_RIGHT,KC_NO, KC_NO, KC_NO, LT_SFT, KC_NO, KC_P0, KC_P1, KC_P2, KC_P3, KC_MUTE, KC_MPLY,KC_PGUP, KC_NO, KC_PGDN, KC_NO, KC_NO, KC_RIGHT_SHIFT, - KC_LCTL, KC_LGUI, KC_BSPC, LY_SYMBOL,AL_SPC, AL_ENT, LY_SYMBOL,KC_NO, KC_RGUI, KC_RCTL + KC_TRNS, KC_TRNS, KC_TRNS, LY_SYMBOL,AL_SPC, AL_ENT, LY_SYMBOL,KC_NO, KC_RGUI, KC_TRNS ), }; #if defined(ENCODER_MAP_ENABLE) const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { - [_BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(KC_MS_WH_UP, KC_MS_WH_DOWN) }, - [LAYER_SYMBOLS] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(KC_MS_WH_UP, KC_MS_WH_DOWN) }, + [LAYER_BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(KC_MS_WH_UP, KC_MS_WH_DOWN) }, + [LAYER_SYMBOLS] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS), ENCODER_CCW_CW(KC_TRNS, KC_TRNS) }, }; #endif diff --git a/qmk/keyboards/sofle_choc/keymaps/custom/quad_tapdance.c b/qmk/keyboards/sofle_choc/keymaps/custom/quad_tapdance.c index 9978315..19b1e46 100644 --- a/qmk/keyboards/sofle_choc/keymaps/custom/quad_tapdance.c +++ b/qmk/keyboards/sofle_choc/keymaps/custom/quad_tapdance.c @@ -33,6 +33,12 @@ td_state_t cur_dance(tap_dance_state_t *state) { if (state->count == 1) { + // The function can be called when the delay is over, or because of + // another tap. + // I do not check here if the delay is over, as soon as another tap + // occurs, I check the state of the key and switch in hold mode if the + // key is still pressed. + // if (!state->pressed) return TD_SINGLE_TAP; // Key has not been interrupted, but the key is still held. Means you want to send a 'HOLD'. else return TD_SINGLE_HOLD; @@ -174,44 +180,6 @@ void lshift_reset(tap_dance_state_t *state, void *user_data) { lshift_tap_state.state = TD_NONE; } -// Definition for the key E -// This key can transform into LEFT CONTROL when hold, but can also transform into È when double tapped. -static td_tap_t e_tap_state = { - .is_press_action = true, - .state = TD_NONE -}; - -// Functions that control what our tap dance key does -void e_finished(tap_dance_state_t *state, void *user_data) { - e_tap_state.state = cur_dance(state); - switch (e_tap_state.state) { - // Remove the layer with a single tap, this way I always have a key to remove the - // the layer, without knowing the previous state I had. - case TD_SINGLE_HOLD: register_code(KC_LEFT_CTRL); break; - case TD_DOUBLE_TAP: - register_code(BP_EGRV); break; - case TD_SINGLE_TAP: - register_code(BP_E); break; - break; - default: break; - } -} - -void e_reset(tap_dance_state_t *state, void *user_data) { - switch (e_tap_state.state) { - case TD_SINGLE_HOLD: unregister_code(KC_LEFT_CTRL); break; - case TD_DOUBLE_TAP: - unregister_code(BP_EGRV); break; - case TD_SINGLE_TAP: - unregister_code(BP_E); break; - break; - default: break; - } - e_tap_state.state = TD_NONE; -} - - - // // Declare the tapdance table here. // @@ -221,6 +189,6 @@ tap_dance_action_t tap_dance_actions[] = { [TD_W_CAPSLOCK] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, w_finished, w_reset), [TD_LAYER_SYMB] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ql_finished, ql_reset), [TD_LSFT] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, lshift_finished, lshift_reset), - [TD_E_EE] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, e_finished, e_reset), + [TD_EE] = ACTION_TAP_DANCE_DOUBLE(BP_COMM, BP_EGRV), }; |