diff options
Diffstat (limited to 'quantum/process_keycode/process_tap_dance.h')
-rw-r--r-- | quantum/process_keycode/process_tap_dance.h | 43 |
1 files changed, 18 insertions, 25 deletions
diff --git a/quantum/process_keycode/process_tap_dance.h b/quantum/process_keycode/process_tap_dance.h index 5cb6d9202c..386f504619 100644 --- a/quantum/process_keycode/process_tap_dance.h +++ b/quantum/process_keycode/process_tap_dance.h @@ -16,18 +16,17 @@ #pragma once -#ifdef TAP_DANCE_ENABLE - -# include <stdbool.h> -# include <inttypes.h> +#include <stdint.h> +#include <stdbool.h> +#include "action.h" typedef struct { uint16_t interrupting_keycode; uint8_t count; uint8_t weak_mods; -# ifndef NO_ACTION_ONESHOT +#ifndef NO_ACTION_ONESHOT uint8_t oneshot_mods; -# endif +#endif bool pressed : 1; bool finished : 1; bool interrupted : 1; @@ -56,24 +55,24 @@ typedef struct { void (*layer_function)(uint8_t); } tap_dance_dual_role_t; -# define ACTION_TAP_DANCE_DOUBLE(kc1, kc2) \ - { .fn = {tap_dance_pair_on_each_tap, tap_dance_pair_finished, tap_dance_pair_reset}, .user_data = (void *)&((tap_dance_pair_t){kc1, kc2}), } +#define ACTION_TAP_DANCE_DOUBLE(kc1, kc2) \ + { .fn = {tap_dance_pair_on_each_tap, tap_dance_pair_finished, tap_dance_pair_reset}, .user_data = (void *)&((tap_dance_pair_t){kc1, kc2}), } -# define ACTION_TAP_DANCE_LAYER_MOVE(kc, layer) \ - { .fn = {tap_dance_dual_role_on_each_tap, tap_dance_dual_role_finished, tap_dance_dual_role_reset}, .user_data = (void *)&((tap_dance_dual_role_t){kc, layer, layer_move}), } +#define ACTION_TAP_DANCE_LAYER_MOVE(kc, layer) \ + { .fn = {tap_dance_dual_role_on_each_tap, tap_dance_dual_role_finished, tap_dance_dual_role_reset}, .user_data = (void *)&((tap_dance_dual_role_t){kc, layer, layer_move}), } -# define ACTION_TAP_DANCE_LAYER_TOGGLE(kc, layer) \ - { .fn = {NULL, tap_dance_dual_role_finished, tap_dance_dual_role_reset}, .user_data = (void *)&((tap_dance_dual_role_t){kc, layer, layer_invert}), } +#define ACTION_TAP_DANCE_LAYER_TOGGLE(kc, layer) \ + { .fn = {NULL, tap_dance_dual_role_finished, tap_dance_dual_role_reset}, .user_data = (void *)&((tap_dance_dual_role_t){kc, layer, layer_invert}), } -# define ACTION_TAP_DANCE_FN(user_fn) \ - { .fn = {NULL, user_fn, NULL}, .user_data = NULL, } +#define ACTION_TAP_DANCE_FN(user_fn) \ + { .fn = {NULL, user_fn, NULL}, .user_data = NULL, } -# define ACTION_TAP_DANCE_FN_ADVANCED(user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset) \ - { .fn = {user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset}, .user_data = NULL, } +#define ACTION_TAP_DANCE_FN_ADVANCED(user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset) \ + { .fn = {user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset}, .user_data = NULL, } -# define TD(n) (QK_TAP_DANCE | TD_INDEX(n)) -# define TD_INDEX(code) ((code)&0xFF) -# define TAP_DANCE_KEYCODE(state) TD(((tap_dance_action_t *)state) - tap_dance_actions) +#define TD(n) (QK_TAP_DANCE | TD_INDEX(n)) +#define TD_INDEX(code) ((code)&0xFF) +#define TAP_DANCE_KEYCODE(state) TD(((tap_dance_action_t *)state) - tap_dance_actions) extern tap_dance_action_t tap_dance_actions[]; @@ -92,9 +91,3 @@ void tap_dance_pair_reset(tap_dance_state_t *state, void *user_data); void tap_dance_dual_role_on_each_tap(tap_dance_state_t *state, void *user_data); void tap_dance_dual_role_finished(tap_dance_state_t *state, void *user_data); void tap_dance_dual_role_reset(tap_dance_state_t *state, void *user_data); - -#else - -# define TD(n) KC_NO - -#endif |