Skip to content

Commit

Permalink
tap-dance: Restructure code and document in more detail (qmk#16394)
Browse files Browse the repository at this point in the history
  • Loading branch information
joukewitteveen authored and zykrah committed Jul 2, 2022
1 parent 90762c9 commit 3ebb508
Show file tree
Hide file tree
Showing 52 changed files with 975 additions and 237 deletions.
2 changes: 1 addition & 1 deletion builddefs/build_test.mk
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ VPATH += \

all: elf

VPATH += $(COMMON_VPATH)
VPATH += $(TEST_PATH) $(COMMON_VPATH)
PLATFORM:=TEST
PLATFORM_KEY:=test
BOOTLOADER_TYPE:=none
Expand Down
143 changes: 90 additions & 53 deletions docs/feature_tap_dance.md

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion docs/ja/feature_tap_dance.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
* `ACTION_TAP_DANCE_DOUBLE(kc1, kc2)`: 1回タップすると `kc1` キーコードを送信し、2回タップすると `kc2` キーコードを送信します。キーを押し続けているときは、適切なキーコードが登録されます: キーを押し続けた場合は `kc1`、一度タップしてから続けてもう一度キーを押してそのまま押し続けたときは、 `kc2` が登録されます。
* `ACTION_TAP_DANCE_LAYER_MOVE(kc, layer)`: 1回タップすると `kc` キーコードが送信され、2回タップすると `layer` レイヤーに移動します(これは `TO` レイヤーキーコードのように機能します)。
* この機能は `ACTION_TAP_DANCE_DUAL_ROLE` と同じですが、機能が明確になるように関数名を変更しました。どちらの関数名でも実行できます。
* `ACTION_TAP_DANCE_LAYER_TOGGLE(kc, layer)`: 1回タップすると `kc` キーコードが送信され、2回タップすると `layer` の状態をトグルします(これは `TG` レイヤーキーコードのように機能します)。
* `ACTION_TAP_DANCE_FN(fn)`: ユーザーキーマップに定義した指定の関数が呼び出されます。タップダンス実行の回数分タップすると、最後の時点で呼び出されます。
* `ACTION_TAP_DANCE_FN_ADVANCED(on_each_tap_fn, on_dance_finished_fn, on_dance_reset_fn)`: タップする度にユーザーキーマップに定義した最初の関数が呼び出されます。タップダンスの実行が終わった時点で2番目の関数が呼び出され、タップダンスの実行をリセットするときに最後の関数が呼び出されます。
Expand Down
4 changes: 2 additions & 2 deletions keyboards/basekeys/slice/rev1/keymaps/2moons/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ enum tapdances{
};

qk_tap_dance_action_t tap_dance_actions[] = {
[TD_ESFL] = ACTION_TAP_DANCE_DUAL_ROLE(KC_ESC, _FLOCK),
[TD_ESQW] = ACTION_TAP_DANCE_DUAL_ROLE(KC_ESC, _QWERTY),
[TD_ESFL] = ACTION_TAP_DANCE_LAYER_MOVE(KC_ESC, _FLOCK),
[TD_ESQW] = ACTION_TAP_DANCE_LAYER_MOVE(KC_ESC, _QWERTY),
};

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
Expand Down
4 changes: 2 additions & 2 deletions keyboards/basekeys/slice/rev1_rgb/keymaps/2moons_rgb/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ enum tapdances{
};

qk_tap_dance_action_t tap_dance_actions[] = {
[TD_ESFL] = ACTION_TAP_DANCE_DUAL_ROLE(KC_ESC, _FLOCK),
[TD_ESQW] = ACTION_TAP_DANCE_DUAL_ROLE(KC_ESC, _QWERTY),
[TD_ESFL] = ACTION_TAP_DANCE_LAYER_MOVE(KC_ESC, _FLOCK),
[TD_ESQW] = ACTION_TAP_DANCE_LAYER_MOVE(KC_ESC, _QWERTY),
};

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
Expand Down
1 change: 1 addition & 0 deletions keyboards/bpiphany/frosty_flake/keymaps/nikchi/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

// place overrides here
#define TAPPING_TERM 200
#define TAPPING_TERM_PER_KEY
#define LEADER_TIMEOUT 800

#define DISABLE_SPACE_CADET_ROLLOVER
Expand Down
32 changes: 24 additions & 8 deletions keyboards/bpiphany/frosty_flake/keymaps/nikchi/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,33 @@ qk_tap_dance_action_t tap_dance_actions[] = {
// Tap once for CTRL, twice for Caps Lock
[TD_CTCPS] = ACTION_TAP_DANCE_DOUBLE(KC_LCTL, KC_CAPS),
[COPA] = ACTION_TAP_DANCE_DOUBLE(LCTL(KC_C), LCTL(KC_V)),
[EMOJIS] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(cycleEmojis, NULL, NULL, 800),
[ANIMAL] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(cycleAnimals, NULL, NULL, 800),
//[SYMBOLS] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(cycleSymbols, NULL, NULL, 800),
[FOODS] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(cycleFoods, NULL, NULL, 800),
[ETC] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(cycleEtc, NULL, NULL, 800),
//[VEHICLES] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(cycleVehicles, NULL, NULL, 800),
//[SUPPLEMENT] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(cycleSupplement, NULL, NULL, 800),
[ALLS] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(cycleAll, NULL, NULL, 800)
[EMOJIS] = ACTION_TAP_DANCE_FN_ADVANCED(cycleEmojis, NULL, NULL),
[ANIMAL] = ACTION_TAP_DANCE_FN_ADVANCED(cycleAnimals, NULL, NULL),
//[SYMBOLS] = ACTION_TAP_DANCE_FN_ADVANCED(cycleSymbols, NULL, NULL),
[FOODS] = ACTION_TAP_DANCE_FN_ADVANCED(cycleFoods, NULL, NULL),
[ETC] = ACTION_TAP_DANCE_FN_ADVANCED(cycleEtc, NULL, NULL),
//[VEHICLES] = ACTION_TAP_DANCE_FN_ADVANCED(cycleVehicles, NULL, NULL),
//[SUPPLEMENT] = ACTION_TAP_DANCE_FN_ADVANCED(cycleSupplement, NULL, NULL),
[ALLS] = ACTION_TAP_DANCE_FN_ADVANCED(cycleAll, NULL, NULL)
// Other declarations would go here, separated by commas, if you have them
};

uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case TD(EMOJIS):
case TD(ANIMAL):
//case TD(SYMBOLS):
case TD(FOODS):
case TD(ETC):
//case TD(VEHICLES):
//case TD(SUPPLEMENT):
case TD(ALLS):
return 800;
default:
return TAPPING_TERM;
}
}

// macros
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
switch(id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,4 @@ Tap Dance is constrained normally by `TAPPING_TERM` defined in your keyboard's c



- `ACTION_TAP_DANCE_FN_ADVANCED_TIME(user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset, tap_specific_tapping_term)` : This works the same as `ACTION_TAP_DANCE_FN_ADVANCED` just with the extra `tap_specific_tapping_term` arguement at the end. This way you can set a specific tap dance to have a longer or shorter tap in between your taps, giving you more, or less, time in between each tap.


`tap_specific_tapping_term` should be the same type and range of values that one would put into the `TAPPING_TERM` definition in the config.h file.
- Implementing `uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record)`, you can set a specific tap dance to have a longer or shorter tap in between your taps, giving you more, or less, time in between each tap. The return value should be the same type and range of values that one would put into the `TAPPING_TERM` definition in the config.h file.
4 changes: 2 additions & 2 deletions keyboards/duck/lightsaver/keymaps/rasmus/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ enum {

//Tap Dance Definitions
qk_tap_dance_action_t tap_dance_actions[] = {
[TD_F1_GAME] = ACTION_TAP_DANCE_DUAL_ROLE(KC_F1, GAME),
[TD_CAPS_FN] = ACTION_TAP_DANCE_DUAL_ROLE(KC_CAPS, 5)
[TD_F1_GAME] = ACTION_TAP_DANCE_LAYER_MOVE(KC_F1, GAME),
[TD_CAPS_FN] = ACTION_TAP_DANCE_LAYER_MOVE(KC_CAPS, 5)
};

enum macro_id {
Expand Down
1 change: 1 addition & 0 deletions keyboards/ergodox_ez/keymaps/hacker_dvorak/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#undef TAPPING_TERM
#define TAPPING_TERM 175
#define TAPPING_TERM_PER_KEY

#undef DEBOUNCE
#define DEBOUNCE 15
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,32 @@ qk_tap_dance_action_t tap_dance_actions[] = {
[RPRN_RBRC] = ACTION_TAP_DANCE_DOUBLE(KC_RPRN, KC_RBRC),
[LCBR_LABK] = ACTION_TAP_DANCE_DOUBLE(KC_LCBR, KC_LABK),
[RCBR_RABK] = ACTION_TAP_DANCE_DOUBLE(KC_RCBR, KC_RABK),
[SCLN_COLN] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, scln_coln_finished, scln_coln_reset, DANCING_TERM),
[QUOT_DQUO] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, quot_dquot_finished, quot_dquot_reset, DANCING_TERM),
[DOT_COMM] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, dot_comm_finished, dot_comm_reset, DANCING_TERM),
[NONE_LEAD] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, none_lead_finished, none_lead_reset, DANCING_TERM),
[U_ARR_GUI] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, u_arrows_gui_finished, u_arrows_gui_reset, DANCING_TERM),
[H_MOU_GUI] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, h_mouse_gui_finished, h_mouse_gui_reset, DANCING_TERM),
[J_MED_MEH] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, j_media_meh_finished, j_media_meh_reset, DANCING_TERM),
[W_MED_MEH] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, w_media_meh_finished, w_media_meh_reset, DANCING_TERM),
[K_NUM_HYP] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, k_numpad_hyper_finished, k_numpad_hyper_reset, DANCING_TERM),
[M_CHO_HYP] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, m_chords_hyper_finished, m_chords_hyper_reset, DANCING_TERM),
[SCLN_COLN] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, scln_coln_finished, scln_coln_reset),
[QUOT_DQUO] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, quot_dquot_finished, quot_dquot_reset),
[DOT_COMM] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dot_comm_finished, dot_comm_reset),
[NONE_LEAD] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, none_lead_finished, none_lead_reset),
[U_ARR_GUI] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, u_arrows_gui_finished, u_arrows_gui_reset),
[H_MOU_GUI] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, h_mouse_gui_finished, h_mouse_gui_reset),
[J_MED_MEH] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, j_media_meh_finished, j_media_meh_reset),
[W_MED_MEH] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, w_media_meh_finished, w_media_meh_reset),
[K_NUM_HYP] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, k_numpad_hyper_finished, k_numpad_hyper_reset),
[M_CHO_HYP] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, m_chords_hyper_finished, m_chords_hyper_reset),
};

uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case TD(SCLN_COLN):
case TD(QUOT_DQUO):
case TD(DOT_COMM):
case TD(NONE_LEAD):
case TD(U_ARR_GUI):
case TD(H_MOU_GUI):
case TD(J_MED_MEH):
case TD(W_MED_MEH):
case TD(K_NUM_HYP):
case TD(M_CHO_HYP):
return DANCING_TERM;
default:
return TAPPING_TERM;
}
}
2 changes: 2 additions & 0 deletions keyboards/gboards/gergoplex/keymaps/georgepetri/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

#define COMBO_ALLOW_ACTION_KEYS
#define COMBO_VARIABLE_LEN

#define TAPPING_TERM_PER_KEY
11 changes: 10 additions & 1 deletion keyboards/gboards/gergoplex/keymaps/georgepetri/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,5 +199,14 @@ void ql_reset(qk_tap_dance_state_t *state, void *user_data) {
}

qk_tap_dance_action_t tap_dance_actions[] = {
[GAME] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, ql_finished, ql_reset, 275)
[GAME] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ql_finished, ql_reset)
};

uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QK_TAP_DANCE ... QK_TAP_DANCE_MAX:
return 275;
default:
return TAPPING_TERM;
}
}
6 changes: 3 additions & 3 deletions keyboards/handwired/ortho5x14/keymaps/2u/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,9 @@ qk_tap_dance_action_t tap_dance_actions[] = {
[TD_PGUP_HOME] = ACTION_TAP_DANCE_DOUBLE(KC_PGUP, KC_HOME),
[TD_PGDN_END] = ACTION_TAP_DANCE_DOUBLE(KC_PGDN, KC_END),

[TD_Q_LrALT] = ACTION_TAP_DANCE_DUAL_ROLE(KC_Q, _ALT),
[TD_R_LrKey] = ACTION_TAP_DANCE_DUAL_ROLE(KC_R, _RAISE),
[TD_T_LrMS] = ACTION_TAP_DANCE_DUAL_ROLE(KC_T, _MOUSE),
[TD_Q_LrALT] = ACTION_TAP_DANCE_LAYER_MOVE(KC_Q, _ALT),
[TD_R_LrKey] = ACTION_TAP_DANCE_LAYER_MOVE(KC_R, _RAISE),
[TD_T_LrMS] = ACTION_TAP_DANCE_LAYER_MOVE(KC_T, _MOUSE),

[TD_SHIFT_CAPS] = ACTION_TAP_DANCE_FN_ADVANCED(NULL,lshift_finished, lshift_reset),
[TD_SPC_ENT] = ACTION_TAP_DANCE_DOUBLE(KC_SPACE, KC_ENT),
Expand Down
6 changes: 3 additions & 3 deletions keyboards/handwired/ortho5x14/keymaps/split1/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,9 @@ qk_tap_dance_action_t tap_dance_actions[] = {
[TD_PGUP_HOME] = ACTION_TAP_DANCE_DOUBLE(KC_PGUP, KC_HOME),
[TD_PGDN_END] = ACTION_TAP_DANCE_DOUBLE(KC_PGUP, KC_END),

[TD_Q_LrALT] = ACTION_TAP_DANCE_DUAL_ROLE(KC_Q, _ALT),
[TD_R_LrKey] = ACTION_TAP_DANCE_DUAL_ROLE(KC_R, _RAISE),
[TD_T_LrMS] = ACTION_TAP_DANCE_DUAL_ROLE(KC_T, _MOUSE),
[TD_Q_LrALT] = ACTION_TAP_DANCE_LAYER_MOVE(KC_Q, _ALT),
[TD_R_LrKey] = ACTION_TAP_DANCE_LAYER_MOVE(KC_R, _RAISE),
[TD_T_LrMS] = ACTION_TAP_DANCE_LAYER_MOVE(KC_T, _MOUSE),

[TD_SHIFT_CAPS] = ACTION_TAP_DANCE_FN_ADVANCED(NULL,lshift_finished, lshift_reset),
[TD_SPC_ENT] = ACTION_TAP_DANCE_DOUBLE(KC_SPACE, KC_ENT),
Expand Down
1 change: 1 addition & 0 deletions keyboards/jones/v03/keymaps/default_jp/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@

// time for long press
#define TAPPING_TERM 200
#define TAPPING_TERM_PER_KEY
15 changes: 12 additions & 3 deletions keyboards/jones/v03/keymaps/default_jp/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,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,
Expand Down Expand Up @@ -303,7 +312,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:
Expand Down Expand Up @@ -332,7 +341,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) {
Expand Down
1 change: 1 addition & 0 deletions keyboards/jones/v03_1/keymaps/default_ansi/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

// time for long press
#define TAPPING_TERM 200
#define TAPPING_TERM_PER_KEY

// music map for music-mode
#define MUSIC_MAP
15 changes: 12 additions & 3 deletions keyboards/jones/v03_1/keymaps/default_ansi/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions keyboards/jones/v03_1/keymaps/default_jp/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

// time for long press
#define TAPPING_TERM 200
#define TAPPING_TERM_PER_KEY

// music map for music-mode
#define MUSIC_MAP
15 changes: 12 additions & 3 deletions keyboards/jones/v03_1/keymaps/default_jp/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,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,
Expand Down Expand Up @@ -324,7 +333,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:
Expand Down Expand Up @@ -353,7 +362,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) {
Expand Down
2 changes: 1 addition & 1 deletion keyboards/keyhive/navi10/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,5 +127,5 @@ void tk_reset(qk_tap_dance_state_t *state, void *user_data){

//associate the tap dance key with its functionality
qk_tap_dance_action_t tap_dance_actions[] = {
[TAPPY_KEY] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, tk_finished, tk_reset, 275)
[TAPPY_KEY] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, tk_finished, tk_reset)
};
2 changes: 1 addition & 1 deletion keyboards/keyhive/navi10/keymaps/devdev/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,5 +259,5 @@ void tk_reset(qk_tap_dance_state_t *state, void *user_data){

//associate the tap dance key with its functionality
qk_tap_dance_action_t tap_dance_actions[] = {
[TAPPY_KEY] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, tk_finished, tk_reset, TAPPING_TERM)
[TAPPY_KEY] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, tk_finished, tk_reset)
};
2 changes: 1 addition & 1 deletion keyboards/keyhive/navi10/keymaps/emdarcher/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,5 +178,5 @@ void tk_reset(qk_tap_dance_state_t *state, void *user_data){

//associate the tap dance key with its functionality
qk_tap_dance_action_t tap_dance_actions[] = {
[TAPPY_KEY] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, tk_finished, tk_reset, 275)
[TAPPY_KEY] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, tk_finished, tk_reset)
};
1 change: 1 addition & 0 deletions keyboards/kprepublic/jj50/keymaps/archetype/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
#define AUTO_SHIFT_TIMEOUT 150
#define NO_AUTO_SHIFT_ALPHA
#define TAPPING_TERM 150
#define TAPPING_TERM_PER_KEY
//#define BOOTMAGIC_KEY_SALT KC_LCTL
11 changes: 10 additions & 1 deletion keyboards/kprepublic/jj50/keymaps/archetype/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,18 @@ qk_tap_dance_action_t tap_dance_actions[] = {
// Single tap = ) | Double tap = ] | Triple tap = } | Single hold = KC_LALT
[TD_LALT_RBRC] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, right_brackets, right_brackets_reset),
// Layer Switcher ESC
[TD_ESC_LAYER] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, layer_switcher, layer_switcher_reset, 100),
[TD_ESC_LAYER] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, layer_switcher, layer_switcher_reset),
};

uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case TD(TD_ESC_LAYER):
return 100;
default:
return TAPPING_TERM;
}
}


const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

Expand Down
1 change: 1 addition & 0 deletions keyboards/planck/keymaps/ariccb/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
//#define MIDI_ADVANCED

#define TAPPING_TERM 150
#define TAPPING_TERM_PER_KEY
#define IGNORE_MOD_TAP_INTERRUPT
// #define IGNORE_MOD_TAP_INTERRUPT
// #define HOLD_ON_OTHER_KEY_PRESS
Expand Down
Loading

0 comments on commit 3ebb508

Please sign in to comment.