Skip to content

Commit

Permalink
Merge pull request qmk#572 from algernon/f/tap-dance-debug
Browse files Browse the repository at this point in the history
tap-dance: Add some debugging support
  • Loading branch information
jackhumbert authored Jul 28, 2016
2 parents 56c6289 + 80e24e4 commit d4f9b84
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
15 changes: 15 additions & 0 deletions quantum/process_keycode/process_tap_dance.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
#include "quantum.h"

static qk_tap_dance_state_t qk_tap_dance_state;
bool td_debug_enable = false;

#if CONSOLE_ENABLE
#define td_debug(s) if (td_debug_enable) \
{ \
xprintf ("D:tap_dance:%s:%s = { keycode = %d, count = %d, active = %d, pressed = %d }\n", __FUNCTION__, s, \
qk_tap_dance_state.keycode, qk_tap_dance_state.count, \
qk_tap_dance_state.active, qk_tap_dance_state.pressed); \
}
#else
#define td_debug(s)
#endif

void qk_tap_dance_pair_finished (qk_tap_dance_state_t *state, void *user_data) {
qk_tap_dance_pair_t *pair = (qk_tap_dance_pair_t *)user_data;
Expand Down Expand Up @@ -33,16 +45,19 @@ static inline void _process_tap_dance_action_fn (qk_tap_dance_state_t *state,

static inline void process_tap_dance_action_on_each_tap (qk_tap_dance_action_t action)
{
td_debug("trigger");
_process_tap_dance_action_fn (&qk_tap_dance_state, action.user_data, action.fn.on_each_tap);
}

static inline void process_tap_dance_action_on_dance_finished (qk_tap_dance_action_t action)
{
td_debug("trigger");
_process_tap_dance_action_fn (&qk_tap_dance_state, action.user_data, action.fn.on_dance_finished);
}

static inline void process_tap_dance_action_on_reset (qk_tap_dance_action_t action)
{
td_debug("trigger")
_process_tap_dance_action_fn (&qk_tap_dance_state, action.user_data, action.fn.on_reset);
}

Expand Down
1 change: 1 addition & 0 deletions quantum/process_keycode/process_tap_dance.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ typedef struct
}

extern const qk_tap_dance_action_t tap_dance_actions[];
extern bool td_debug_enable;

/* To be used internally */

Expand Down

0 comments on commit d4f9b84

Please sign in to comment.