diff options
author | Drashna Jaelre <drashna@live.com> | 2019-09-21 11:22:27 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-21 11:22:27 -0700 |
commit | f069e9fc09859baf03d940b6db47e95c50a24936 (patch) | |
tree | 429cd294d22c0a9af6965af68f047e9482fc0cef /quantum/process_keycode/process_tap_dance.h | |
parent | 63a0b1241d204873cd5156a959e913c602b0c386 (diff) | |
download | qmk_firmware-f069e9fc09859baf03d940b6db47e95c50a24936.tar.gz |
Generalize Tap Dance Layer functions (#6629)
* made tapdance dual_role general
* updated original dual_role functionality
* added toggling layer example
* Fix dual role and add alias
* Update docs about new layer tap dances
* Fix up based on feedback
Diffstat (limited to 'quantum/process_keycode/process_tap_dance.h')
-rw-r--r-- | quantum/process_keycode/process_tap_dance.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/quantum/process_keycode/process_tap_dance.h b/quantum/process_keycode/process_tap_dance.h index b2d0cb829..8d227dfd7 100644 --- a/quantum/process_keycode/process_tap_dance.h +++ b/quantum/process_keycode/process_tap_dance.h @@ -56,13 +56,19 @@ typedef struct { typedef struct { uint16_t kc; uint8_t layer; + void (*layer_function)(uint8_t); } qk_tap_dance_dual_role_t; # define ACTION_TAP_DANCE_DOUBLE(kc1, kc2) \ { .fn = {qk_tap_dance_pair_on_each_tap, qk_tap_dance_pair_finished, qk_tap_dance_pair_reset}, .user_data = (void *)&((qk_tap_dance_pair_t){kc1, kc2}), } # define ACTION_TAP_DANCE_DUAL_ROLE(kc, layer) \ - { .fn = {qk_tap_dance_dual_role_on_each_tap, qk_tap_dance_dual_role_finished, qk_tap_dance_dual_role_reset}, .user_data = (void *)&((qk_tap_dance_dual_role_t){kc, layer}), } + { .fn = { qk_tap_dance_dual_role_on_each_tap, qk_tap_dance_dual_role_finished, qk_tap_dance_dual_role_reset }, .user_data = (void *)&((qk_tap_dance_dual_role_t) { kc, layer, layer_move }), } + +# define ACTION_TAP_DANCE_TOGGLE_LAYER(kc, layer) \ + { .fn = { NULL, qk_tap_dance_dual_role_finished, qk_tap_dance_dual_role_reset }, .user_data = (void *)&((qk_tap_dance_dual_role_t) { kc, layer, layer_invert }), } + +# define ACTION_TAP_DANCE_LAYER_MOVE(kc, layer) ACTION_TAP_DANCE_DUAL_ROLE(kc, layer) # define ACTION_TAP_DANCE_FN(user_fn) \ { .fn = {NULL, user_fn, NULL}, .user_data = NULL, } @@ -73,6 +79,8 @@ typedef struct { # define 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) \ { .fn = {user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset}, .user_data = NULL, .custom_tapping_term = tap_specific_tapping_term, } + + extern qk_tap_dance_action_t tap_dance_actions[]; /* To be used internally */ |