]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
tap-dance: Add some debugging support
authorGergely Nagy <algernon@madhouse-project.org>
Wed, 27 Jul 2016 06:42:09 +0000 (08:42 +0200)
committerGergely Nagy <algernon@madhouse-project.org>
Wed, 27 Jul 2016 12:49:19 +0000 (14:49 +0200)
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
quantum/process_keycode/process_tap_dance.c
quantum/process_keycode/process_tap_dance.h

index d240dc2e66c3fd8ad3e62d8b2f0dd3321d9837ef..5429e34383573124af5ac456ad4762e415937429 100644 (file)
@@ -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;
@@ -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);
 }
 
index e2c74efe914e6339d06f02d67f2a0fd67c7e46a2..6a1258067eb7bc7fcc1b9ba44873126064263906 100644 (file)
@@ -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 */