diff options
author | Gergely Nagy <algernon@madhouse-project.org> | 2016-07-27 08:42:09 +0200 |
---|---|---|
committer | Gergely Nagy <algernon@madhouse-project.org> | 2016-07-27 14:49:19 +0200 |
commit | b21e8b97acb722bfa7b85831cfd010716ed77962 (patch) | |
tree | f4bac02f0a3f75e9e95c6d9d03489f7a8289d044 /quantum/process_keycode | |
parent | 93f366fa7d59d0a3abb03879da88082a1e2128a8 (diff) | |
download | qmk_firmware-b21e8b97acb722bfa7b85831cfd010716ed77962.tar.gz qmk_firmware-b21e8b97acb722bfa7b85831cfd010716ed77962.zip |
tap-dance: Add some debugging support
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Diffstat (limited to 'quantum/process_keycode')
-rw-r--r-- | quantum/process_keycode/process_tap_dance.c | 15 | ||||
-rw-r--r-- | quantum/process_keycode/process_tap_dance.h | 1 |
2 files changed, 16 insertions, 0 deletions
diff --git a/quantum/process_keycode/process_tap_dance.c b/quantum/process_keycode/process_tap_dance.c index d240dc2e6..5429e3438 100644 --- a/quantum/process_keycode/process_tap_dance.c +++ b/quantum/process_keycode/process_tap_dance.c | |||
@@ -1,6 +1,18 @@ | |||
1 | #include "quantum.h" | 1 | #include "quantum.h" |
2 | 2 | ||
3 | static qk_tap_dance_state_t qk_tap_dance_state; | 3 | static qk_tap_dance_state_t qk_tap_dance_state; |
4 | bool td_debug_enable = false; | ||
5 | |||
6 | #if CONSOLE_ENABLE | ||
7 | #define td_debug(s) if (td_debug_enable) \ | ||
8 | { \ | ||
9 | xprintf ("D:tap_dance:%s:%s = { keycode = %d, count = %d, active = %d, pressed = %d }\n", __FUNCTION__, s, \ | ||
10 | qk_tap_dance_state.keycode, qk_tap_dance_state.count, \ | ||
11 | qk_tap_dance_state.active, qk_tap_dance_state.pressed); \ | ||
12 | } | ||
13 | #else | ||
14 | #define td_debug(s) | ||
15 | #endif | ||
4 | 16 | ||
5 | void qk_tap_dance_pair_finished (qk_tap_dance_state_t *state, void *user_data) { | 17 | void qk_tap_dance_pair_finished (qk_tap_dance_state_t *state, void *user_data) { |
6 | qk_tap_dance_pair_t *pair = (qk_tap_dance_pair_t *)user_data; | 18 | qk_tap_dance_pair_t *pair = (qk_tap_dance_pair_t *)user_data; |
@@ -33,16 +45,19 @@ static inline void _process_tap_dance_action_fn (qk_tap_dance_state_t *state, | |||
33 | 45 | ||
34 | static inline void process_tap_dance_action_on_each_tap (qk_tap_dance_action_t action) | 46 | static inline void process_tap_dance_action_on_each_tap (qk_tap_dance_action_t action) |
35 | { | 47 | { |
48 | td_debug("trigger"); | ||
36 | _process_tap_dance_action_fn (&qk_tap_dance_state, action.user_data, action.fn.on_each_tap); | 49 | _process_tap_dance_action_fn (&qk_tap_dance_state, action.user_data, action.fn.on_each_tap); |
37 | } | 50 | } |
38 | 51 | ||
39 | static inline void process_tap_dance_action_on_dance_finished (qk_tap_dance_action_t action) | 52 | static inline void process_tap_dance_action_on_dance_finished (qk_tap_dance_action_t action) |
40 | { | 53 | { |
54 | td_debug("trigger"); | ||
41 | _process_tap_dance_action_fn (&qk_tap_dance_state, action.user_data, action.fn.on_dance_finished); | 55 | _process_tap_dance_action_fn (&qk_tap_dance_state, action.user_data, action.fn.on_dance_finished); |
42 | } | 56 | } |
43 | 57 | ||
44 | static inline void process_tap_dance_action_on_reset (qk_tap_dance_action_t action) | 58 | static inline void process_tap_dance_action_on_reset (qk_tap_dance_action_t action) |
45 | { | 59 | { |
60 | td_debug("trigger") | ||
46 | _process_tap_dance_action_fn (&qk_tap_dance_state, action.user_data, action.fn.on_reset); | 61 | _process_tap_dance_action_fn (&qk_tap_dance_state, action.user_data, action.fn.on_reset); |
47 | } | 62 | } |
48 | 63 | ||
diff --git a/quantum/process_keycode/process_tap_dance.h b/quantum/process_keycode/process_tap_dance.h index e2c74efe9..6a1258067 100644 --- a/quantum/process_keycode/process_tap_dance.h +++ b/quantum/process_keycode/process_tap_dance.h | |||
@@ -49,6 +49,7 @@ typedef struct | |||
49 | } | 49 | } |
50 | 50 | ||
51 | extern const qk_tap_dance_action_t tap_dance_actions[]; | 51 | extern const qk_tap_dance_action_t tap_dance_actions[]; |
52 | extern bool td_debug_enable; | ||
52 | 53 | ||
53 | /* To be used internally */ | 54 | /* To be used internally */ |
54 | 55 | ||