tap-dance: Restructure code and document in more detail (#16394)
This commit is contained in:
parent
b17324498e
commit
1706da9054
52 changed files with 970 additions and 244 deletions
|
@ -50,9 +50,18 @@ void ql_reset(qk_tap_dance_state_t *state, void *user_data);
|
|||
// Tap Dance definitions
|
||||
qk_tap_dance_action_t tap_dance_actions[] = {
|
||||
[TD_LSFT_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_LSFT, KC_CAPS),
|
||||
[TD_ESC_NUM] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, ql_finished, ql_reset, 275),
|
||||
[TD_ESC_NUM] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ql_finished, ql_reset),
|
||||
};
|
||||
|
||||
uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
case TD(TD_ESC_NUM):
|
||||
return 275;
|
||||
default:
|
||||
return TAPPING_TERM;
|
||||
}
|
||||
}
|
||||
|
||||
// Defines the keycodes used by our macros in process_record_user
|
||||
enum custom_keycodes {
|
||||
MAC = SAFE_RANGE,
|
||||
|
@ -322,7 +331,7 @@ static tap ql_tap_state = {
|
|||
// Functions that control what our tap dance key does
|
||||
void ql_finished(qk_tap_dance_state_t *state, void *user_data) {
|
||||
ql_tap_state.state = cur_dance(state);
|
||||
switch(state->keycode) {
|
||||
switch(TAP_DANCE_KEYCODE(state)) {
|
||||
case TD(TD_ESC_NUM): // ESC key action
|
||||
switch (ql_tap_state.state) {
|
||||
case SINGLE_TAP:
|
||||
|
@ -351,7 +360,7 @@ void ql_finished(qk_tap_dance_state_t *state, void *user_data) {
|
|||
}
|
||||
|
||||
void ql_reset(qk_tap_dance_state_t *state, void *user_data) {
|
||||
switch(state->keycode) {
|
||||
switch(TAP_DANCE_KEYCODE(state)) {
|
||||
case TD(TD_ESC_NUM):
|
||||
// If the key was held down and now is released then switch off the layer
|
||||
if (ql_tap_state.state == TAP_HOLD) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue