Skip to content

Commit

Permalink
Tap Dance: remove qk_ prefix (qmk#19313)
Browse files Browse the repository at this point in the history
  • Loading branch information
fauxpark committed Dec 14, 2022
1 parent 83e8e58 commit 1978007
Show file tree
Hide file tree
Showing 298 changed files with 1,328 additions and 1,328 deletions.
64 changes: 32 additions & 32 deletions docs/feature_tap_dance.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ enum {
};
// Tap Dance definitions
qk_tap_dance_action_t tap_dance_actions[] = {
tap_dance_action_t tap_dance_actions[] = {
// Tap once for Escape, twice for Caps Lock
[TD_ESC_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_ESC, KC_CAPS),
};
Expand Down Expand Up @@ -96,14 +96,14 @@ enum {
#### Example 1: Send "Safety Dance!" After 100 Taps :id=example-1

```c
void dance_egg(qk_tap_dance_state_t *state, void *user_data) {
void dance_egg(tap_dance_state_t *state, void *user_data) {
if (state->count >= 100) {
SEND_STRING("Safety dance!");
reset_tap_dance(state);
}
}

qk_tap_dance_action_t tap_dance_actions[] = {
tap_dance_action_t tap_dance_actions[] = {
[CT_EGG] = ACTION_TAP_DANCE_FN(dance_egg),
};
```
Expand All @@ -113,7 +113,7 @@ qk_tap_dance_action_t tap_dance_actions[] = {
```c
// On each tap, light up one LED, from right to left
// On the fourth tap, turn them off from right to left
void dance_flsh_each(qk_tap_dance_state_t *state, void *user_data) {
void dance_flsh_each(tap_dance_state_t *state, void *user_data) {
switch (state->count) {
case 1:
ergodox_right_led_3_on();
Expand All @@ -134,14 +134,14 @@ void dance_flsh_each(qk_tap_dance_state_t *state, void *user_data) {
}
// On the fourth tap, set the keyboard on flash state
void dance_flsh_finished(qk_tap_dance_state_t *state, void *user_data) {
void dance_flsh_finished(tap_dance_state_t *state, void *user_data) {
if (state->count >= 4) {
reset_keyboard();
}
}
// If the flash state didn't happen, then turn off LEDs, left to right
void dance_flsh_reset(qk_tap_dance_state_t *state, void *user_data) {
void dance_flsh_reset(tap_dance_state_t *state, void *user_data) {
ergodox_right_led_1_off();
wait_ms(50);
ergodox_right_led_2_off();
Expand All @@ -150,7 +150,7 @@ void dance_flsh_reset(qk_tap_dance_state_t *state, void *user_data) {
}
// All tap dances now put together. Example 2 is "CT_FLSH"
qk_tap_dance_action_t tap_dance_actions[] = {
tap_dance_action_t tap_dance_actions[] = {
[TD_ESC_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_ESC, KC_CAPS),
[CT_EGG] = ACTION_TAP_DANCE_FN(dance_egg),
[CT_FLSH] = ACTION_TAP_DANCE_FN_ADVANCED(dance_flsh_each, dance_flsh_finished, dance_flsh_reset)
Expand All @@ -169,7 +169,7 @@ typedef struct {
} tap_dance_tap_hold_t;

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
qk_tap_dance_action_t *action;
tap_dance_action_t *action;

switch (keycode) {
case TD(CT_CLN): // list all tap dance keycodes with tap-hold configurations
Expand All @@ -182,7 +182,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
}

void tap_dance_tap_hold_finished(qk_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;

if (state->pressed) {
Expand All @@ -200,7 +200,7 @@ void tap_dance_tap_hold_finished(qk_tap_dance_state_t *state, void *user_data) {
}
}

void tap_dance_tap_hold_reset(qk_tap_dance_state_t *state, void *user_data) {
void tap_dance_tap_hold_reset(tap_dance_state_t *state, void *user_data) {
tap_dance_tap_hold_t *tap_hold = (tap_dance_tap_hold_t *)user_data;

if (tap_hold->held) {
Expand All @@ -212,7 +212,7 @@ void tap_dance_tap_hold_reset(qk_tap_dance_state_t *state, void *user_data) {
#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}), }

qk_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),
};
```
Expand Down Expand Up @@ -256,11 +256,11 @@ enum {
SOME_OTHER_DANCE
};
td_state_t cur_dance(qk_tap_dance_state_t *state);
td_state_t cur_dance(tap_dance_state_t *state);
// For the x tap dance. Put it here so it can be used in any keymap
void x_finished(qk_tap_dance_state_t *state, void *user_data);
void x_reset(qk_tap_dance_state_t *state, void *user_data);
void x_finished(tap_dance_state_t *state, void *user_data);
void x_reset(tap_dance_state_t *state, void *user_data);
```

Now, at the bottom of your `keymap.c` file, you'll need to add the following:
Expand Down Expand Up @@ -293,7 +293,7 @@ Now, at the bottom of your `keymap.c` file, you'll need to add the following:
* For the third point, there does exist the 'TD_DOUBLE_SINGLE_TAP', however this is not fully tested
*
*/
td_state_t cur_dance(qk_tap_dance_state_t *state) {
td_state_t cur_dance(tap_dance_state_t *state) {
if (state->count == 1) {
if (state->interrupted || !state->pressed) return TD_SINGLE_TAP;
// Key has not been interrupted, but the key is still held. Means you want to send a 'HOLD'.
Expand Down Expand Up @@ -322,7 +322,7 @@ static td_tap_t xtap_state = {
.state = TD_NONE
};

void x_finished(qk_tap_dance_state_t *state, void *user_data) {
void x_finished(tap_dance_state_t *state, void *user_data) {
xtap_state.state = cur_dance(state);
switch (xtap_state.state) {
case TD_SINGLE_TAP: register_code(KC_X); break;
Expand All @@ -337,7 +337,7 @@ void x_finished(qk_tap_dance_state_t *state, void *user_data) {
}
}

void x_reset(qk_tap_dance_state_t *state, void *user_data) {
void x_reset(tap_dance_state_t *state, void *user_data) {
switch (xtap_state.state) {
case TD_SINGLE_TAP: unregister_code(KC_X); break;
case TD_SINGLE_HOLD: unregister_code(KC_LCTL); break;
Expand All @@ -349,7 +349,7 @@ void x_reset(qk_tap_dance_state_t *state, void *user_data) {
xtap_state.state = TD_NONE;
}

qk_tap_dance_action_t tap_dance_actions[] = {
tap_dance_action_t tap_dance_actions[] = {
[X_CTL] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, x_finished, x_reset)
};
```
Expand Down Expand Up @@ -385,18 +385,18 @@ static td_state_t td_state;
// Declare your tapdance functions:
// Function to determine the current tapdance state
td_state_t cur_dance(qk_tap_dance_state_t *state);
td_state_t cur_dance(tap_dance_state_t *state);
// `finished` and `reset` functions for each tapdance keycode
void altlp_finished(qk_tap_dance_state_t *state, void *user_data);
void altlp_reset(qk_tap_dance_state_t *state, void *user_data);
void altlp_finished(tap_dance_state_t *state, void *user_data);
void altlp_reset(tap_dance_state_t *state, void *user_data);
```

Below your `LAYOUT`, define each of the tapdance functions:

```c
// Determine the tapdance state to return
td_state_t cur_dance(qk_tap_dance_state_t *state) {
td_state_t cur_dance(tap_dance_state_t *state) {
if (state->count == 1) {
if (state->interrupted || !state->pressed) return TD_SINGLE_TAP;
else return TD_SINGLE_HOLD;
Expand All @@ -408,7 +408,7 @@ td_state_t cur_dance(qk_tap_dance_state_t *state) {

// Handle the possible states for each tapdance keycode you define:

void altlp_finished(qk_tap_dance_state_t *state, void *user_data) {
void altlp_finished(tap_dance_state_t *state, void *user_data) {
td_state = cur_dance(state);
switch (td_state) {
case TD_SINGLE_TAP:
Expand All @@ -426,7 +426,7 @@ void altlp_finished(qk_tap_dance_state_t *state, void *user_data) {
}
}

void altlp_reset(qk_tap_dance_state_t *state, void *user_data) {
void altlp_reset(tap_dance_state_t *state, void *user_data) {
switch (td_state) {
case TD_SINGLE_TAP:
unregister_code16(KC_LPRN);
Expand All @@ -443,7 +443,7 @@ void altlp_reset(qk_tap_dance_state_t *state, void *user_data) {
}

// Define `ACTION_TAP_DANCE_FN_ADVANCED()` for each tapdance keycode, passing in `finished` and `reset` functions
qk_tap_dance_action_t tap_dance_actions[] = {
tap_dance_action_t tap_dance_actions[] = {
[ALT_LP] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, altlp_finished, altlp_reset)
};
```
Expand Down Expand Up @@ -478,18 +478,18 @@ enum {
// Declare the functions to be used with your tap dance key(s)
// Function associated with all tap dances
td_state_t cur_dance(qk_tap_dance_state_t *state);
td_state_t cur_dance(tap_dance_state_t *state);
// Functions associated with individual tap dances
void ql_finished(qk_tap_dance_state_t *state, void *user_data);
void ql_reset(qk_tap_dance_state_t *state, void *user_data);
void ql_finished(tap_dance_state_t *state, void *user_data);
void ql_reset(tap_dance_state_t *state, void *user_data);
```

Towards the bottom of your `keymap.c`, include the following code:

```c
// Determine the current tap dance state
td_state_t cur_dance(qk_tap_dance_state_t *state) {
td_state_t cur_dance(tap_dance_state_t *state) {
if (state->count == 1) {
if (!state->pressed) return TD_SINGLE_TAP;
else return TD_SINGLE_HOLD;
Expand All @@ -504,7 +504,7 @@ static td_tap_t ql_tap_state = {
};

// Functions that control what our tap dance key does
void ql_finished(qk_tap_dance_state_t *state, void *user_data) {
void ql_finished(tap_dance_state_t *state, void *user_data) {
ql_tap_state.state = cur_dance(state);
switch (ql_tap_state.state) {
case TD_SINGLE_TAP:
Expand All @@ -528,7 +528,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) {
void ql_reset(tap_dance_state_t *state, void *user_data) {
// If the key was held down and now is released then switch off the layer
if (ql_tap_state.state == TD_SINGLE_HOLD) {
layer_off(_MY_LAYER);
Expand All @@ -537,7 +537,7 @@ void ql_reset(qk_tap_dance_state_t *state, void *user_data) {
}

// Associate our tap dance key with its functionality
qk_tap_dance_action_t tap_dance_actions[] = {
tap_dance_action_t tap_dance_actions[] = {
[QUOT_LAYR] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ql_finished, ql_reset)
};

Expand Down
2 changes: 1 addition & 1 deletion keyboards/1k/keymaps/tap_dance/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ enum {
TD_AB = 0
};

qk_tap_dance_action_t tap_dance_actions[] = {
tap_dance_action_t tap_dance_actions[] = {
[TD_AB] = ACTION_TAP_DANCE_DOUBLE(KC_A, KC_B)
};

Expand Down
10 changes: 5 additions & 5 deletions keyboards/1upkeyboards/sweet16/keymaps/ridingintraffic/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,32 +155,32 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {


/* tap dance time */
void tdexample1(qk_tap_dance_state_t *state, void *user_data) {
void tdexample1(tap_dance_state_t *state, void *user_data) {
if (state->count >= 2) {
SEND_STRING(EXAMPLESTRING1);
reset_tap_dance (state);
}
}
void tdexample2(qk_tap_dance_state_t *state, void *user_data) {
void tdexample2(tap_dance_state_t *state, void *user_data) {
if (state->count >= 2) {
SEND_STRING(EXAMPLESTRING2);
reset_tap_dance (state);
}
}
void tdexample3(qk_tap_dance_state_t *state, void *user_data) {
void tdexample3(tap_dance_state_t *state, void *user_data) {
if (state->count >= 2) {
SEND_STRING(EXAMPLESTRING3);
reset_tap_dance (state);
}
}
void tdexample4(qk_tap_dance_state_t *state, void *user_data) {
void tdexample4(tap_dance_state_t *state, void *user_data) {
if (state->count >= 2) {
SEND_STRING(EXAMPLESTRING4);
reset_tap_dance (state);
}
}

qk_tap_dance_action_t tap_dance_actions[] = {
tap_dance_action_t tap_dance_actions[] = {
[TD_EXAMPLE1] = ACTION_TAP_DANCE_FN(tdexample1),
[TD_EXAMPLE2] = ACTION_TAP_DANCE_FN(tdexample2),
[TD_EXAMPLE3] = ACTION_TAP_DANCE_FN(tdexample3),
Expand Down
2 changes: 1 addition & 1 deletion keyboards/40percentclub/gherkin/keymaps/mjt/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ void matrix_scan_user(void) {
}

//Tap Dance Definitions
qk_tap_dance_action_t tap_dance_actions[] = {
tap_dance_action_t tap_dance_actions[] = {
//Tap once for Esc, twice for Caps Lock
[TD_Z_LCTL] = ACTION_TAP_DANCE_DOUBLE(KC_Z, KC_LCTL),
[TD_X_LGUI] = ACTION_TAP_DANCE_DOUBLE(KC_X, KC_LGUI),
Expand Down
6 changes: 3 additions & 3 deletions keyboards/40percentclub/half_n_half/keymaps/Boy_314/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
)
};

void tap_dance_choose_layer (qk_tap_dance_state_t *state, void *user_data) {
void tap_dance_choose_layer (tap_dance_state_t *state, void *user_data) {
switch (state->count) {
case 1:
layer_on(_LOWER);
Expand All @@ -119,7 +119,7 @@ void tap_dance_choose_layer (qk_tap_dance_state_t *state, void *user_data) {
}
}

void tap_dance_choose_layer_reset (qk_tap_dance_state_t *state, void *user_data) {
void tap_dance_choose_layer_reset (tap_dance_state_t *state, void *user_data) {
switch (state->count) {
case 1:
layer_off(_LOWER);
Expand All @@ -138,7 +138,7 @@ void tap_dance_choose_layer_reset (qk_tap_dance_state_t *state, void *user_data)
}
}

qk_tap_dance_action_t tap_dance_actions[] = {
tap_dance_action_t tap_dance_actions[] = {
[TD_SWAP_LAYERS] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, tap_dance_choose_layer, tap_dance_choose_layer_reset)
};

Expand Down
2 changes: 1 addition & 1 deletion keyboards/40percentclub/sixpack/keymaps/fkeys/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ enum {
};

// Tap Dance definitions
qk_tap_dance_action_t tap_dance_actions[] = {
tap_dance_action_t tap_dance_actions[] = {
// Tap once for F13 to F18, twice for F19 to F24
[F13F19] = ACTION_TAP_DANCE_DOUBLE(KC_F13, KC_F19), [F14F20] = ACTION_TAP_DANCE_DOUBLE(KC_F14, KC_F20), [F15F21] = ACTION_TAP_DANCE_DOUBLE(KC_F15, KC_F21),
[F16F22] = ACTION_TAP_DANCE_DOUBLE(KC_F16, KC_F22), [F17F23] = ACTION_TAP_DANCE_DOUBLE(KC_F17, KC_F23), [F18F24] = ACTION_TAP_DANCE_DOUBLE(KC_F18, KC_F24)
Expand Down
2 changes: 1 addition & 1 deletion keyboards/9key/keymaps/tap_dance/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

};

qk_tap_dance_action_t tap_dance_actions[] = {
tap_dance_action_t tap_dance_actions[] = {
[ENT_5] = ACTION_TAP_DANCE_DOUBLE(KC_5, KC_ENT),
[ZERO_7] = ACTION_TAP_DANCE_DOUBLE(KC_7, KC_0)
};
Expand Down
2 changes: 1 addition & 1 deletion keyboards/adelheid/keymaps/floookay/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {


// Tap Dance Definitions
qk_tap_dance_action_t tap_dance_actions[] = {
tap_dance_action_t tap_dance_actions[] = {
// Tap once for first parameter, twice for second
[_TD_CTGU] = ACTION_TAP_DANCE_DOUBLE(KC_LCTL, KC_LGUI),
[_TD_PGUP] = ACTION_TAP_DANCE_DOUBLE(KC_PGUP, LCTL(KC_PGUP)),
Expand Down
2 changes: 1 addition & 1 deletion keyboards/arisu/keymaps/fate/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
};

// Tap Dance Definitions
qk_tap_dance_action_t tap_dance_actions[] = {
tap_dance_action_t tap_dance_actions[] = {
// Tap once for L-Alt, twice for L-GUI
[TD_LALT_LGUI] = ACTION_TAP_DANCE_DOUBLE(KC_LALT, KC_LGUI),
// Tap once for R-Alt, twice for R-GUI
Expand Down
2 changes: 1 addition & 1 deletion keyboards/atreus62/keymaps/194h/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ enum {
};

//Tap Dance Definitions
qk_tap_dance_action_t tap_dance_actions[] = {
tap_dance_action_t tap_dance_actions[] = {
//Tap once for semicolon, twice for ø
[SCLN_OE] = ACTION_TAP_DANCE_DOUBLE(NO_SCLN, NO_OE),
//Tap once for single quote, twice for æ
Expand Down
2 changes: 1 addition & 1 deletion keyboards/b_sides/rev41lp/keymaps/namnlos/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ enum dances {
TD_DASH_USCR,
};

qk_tap_dance_action_t tap_dance_actions[] = {
tap_dance_action_t tap_dance_actions[] = {
// Tap once for Shift, twice for Caps Lock
[TD_SHFT_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_LSFT, KC_CAPS),
[TD_COM_SCL] = ACTION_TAP_DANCE_DOUBLE(KC_COMM, SE_SCLN),
Expand Down
2 changes: 1 addition & 1 deletion keyboards/basekeys/slice/rev1/keymaps/2moons/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ enum tapdances{
TD_ESQW,
};

qk_tap_dance_action_t tap_dance_actions[] = {
tap_dance_action_t tap_dance_actions[] = {
[TD_ESFL] = ACTION_TAP_DANCE_LAYER_MOVE(KC_ESC, _FLOCK),
[TD_ESQW] = ACTION_TAP_DANCE_LAYER_MOVE(KC_ESC, _QWERTY),
};
Expand Down
Loading

0 comments on commit 1978007

Please sign in to comment.