mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-07-17 05:02:07 +00:00
Merge remote-tracking branch 'origin/master' into develop
This commit is contained in:
commit
eeac23464b
@ -170,20 +170,6 @@ typedef struct {
|
|||||||
uint16_t held;
|
uint16_t held;
|
||||||
} tap_dance_tap_hold_t;
|
} tap_dance_tap_hold_t;
|
||||||
|
|
||||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|
||||||
tap_dance_action_t *action;
|
|
||||||
|
|
||||||
switch (keycode) {
|
|
||||||
case TD(CT_CLN): // list all tap dance keycodes with tap-hold configurations
|
|
||||||
action = &tap_dance_actions[QK_TAP_DANCE_GET_INDEX(keycode)];
|
|
||||||
if (!record->event.pressed && action->state.count && !action->state.finished) {
|
|
||||||
tap_dance_tap_hold_t *tap_hold = (tap_dance_tap_hold_t *)action->user_data;
|
|
||||||
tap_code16(tap_hold->tap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void tap_dance_tap_hold_finished(tap_dance_state_t *state, void *user_data) {
|
void tap_dance_tap_hold_finished(tap_dance_state_t *state, void *user_data) {
|
||||||
tap_dance_tap_hold_t *tap_hold = (tap_dance_tap_hold_t *)user_data;
|
tap_dance_tap_hold_t *tap_hold = (tap_dance_tap_hold_t *)user_data;
|
||||||
|
|
||||||
@ -211,12 +197,29 @@ void tap_dance_tap_hold_reset(tap_dance_state_t *state, void *user_data) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ACTION_TAP_DANCE_TAP_HOLD(tap, hold) \
|
#define ACTION_TAP_DANCE_TAP_HOLD(tap, hold) \
|
||||||
{ .fn = {NULL, tap_dance_tap_hold_finished, tap_dance_tap_hold_reset}, .user_data = (void *)&((tap_dance_tap_hold_t){tap, hold, 0}), }
|
{ \
|
||||||
|
.fn = {NULL, tap_dance_tap_hold_finished, tap_dance_tap_hold_reset}, \
|
||||||
|
.user_data = (void *)&((tap_dance_tap_hold_t){tap, hold, 0}), \
|
||||||
|
}
|
||||||
|
|
||||||
tap_dance_action_t tap_dance_actions[] = {
|
tap_dance_action_t tap_dance_actions[] = {
|
||||||
[CT_CLN] = ACTION_TAP_DANCE_TAP_HOLD(KC_COLN, KC_SCLN),
|
[CT_CLN] = ACTION_TAP_DANCE_TAP_HOLD(KC_COLN, KC_SCLN),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
tap_dance_action_t *action;
|
||||||
|
|
||||||
|
switch (keycode) {
|
||||||
|
case TD(CT_CLN): // list all tap dance keycodes with tap-hold configurations
|
||||||
|
action = &tap_dance_actions[QK_TAP_DANCE_GET_INDEX(keycode)];
|
||||||
|
if (!record->event.pressed && action->state.count && !action->state.finished) {
|
||||||
|
tap_dance_tap_hold_t *tap_hold = (tap_dance_tap_hold_t *)action->user_data;
|
||||||
|
tap_code16(tap_hold->tap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Example 4: 'Quad Function Tap-Dance' {#example-4}
|
#### Example 4: 'Quad Function Tap-Dance' {#example-4}
|
||||||
|
Loading…
Reference in New Issue
Block a user