summary refs log tree commit diff
path: root/quantum
diff options
context:
space:
mode:
authorStefan Kerkmann <karlk90@pm.me>2022-08-29 19:16:49 +0200
committerGitHub <noreply@github.com>2022-08-29 19:16:49 +0200
commite99ec28f5fffc41ce2662e883f7e9b56383d758b (patch)
tree121c7473da8a04ebffa8d848bdaca22b7b3ec5e6 /quantum
parentd910e8df77150bab0b9cc2c3794554b4c8c81d71 (diff)
[Core] Introduce pointing device specific debug messages (#17663)
Diffstat (limited to 'quantum')
-rw-r--r--quantum/pointing_device/pointing_device_drivers.c22
-rw-r--r--quantum/pointing_device_internal.h14
2 files changed, 21 insertions, 15 deletions
diff --git a/quantum/pointing_device/pointing_device_drivers.c b/quantum/pointing_device/pointing_device_drivers.c
index b96f8ff4b3..096ad5d028 100644
--- a/quantum/pointing_device/pointing_device_drivers.c
+++ b/quantum/pointing_device/pointing_device_drivers.c
@@ -17,6 +17,7 @@
  */
 
 #include "pointing_device.h"
+#include "pointing_device_internal.h"
 #include "debug.h"
 #include "wait.h"
 #include "timer.h"
@@ -32,10 +33,7 @@ report_mouse_t adns5050_get_report(report_mouse_t mouse_report) {
     report_adns5050_t data = adns5050_read_burst();
 
     if (data.dx != 0 || data.dy != 0) {
-#    ifdef CONSOLE_ENABLE
-        if (debug_mouse) dprintf("Raw ] X: %d, Y: %d\n", data.dx, data.dy);
-#    endif
-
+        pd_dprintf("Raw ] X: %d, Y: %d\n", data.dx, data.dy);
         mouse_report.x = (mouse_xy_report_t)data.dx;
         mouse_report.y = (mouse_xy_report_t)data.dy;
     }
@@ -76,9 +74,7 @@ const pointing_device_driver_t pointing_device_driver = {
 report_mouse_t analog_joystick_get_report(report_mouse_t mouse_report) {
     report_analog_joystick_t data = analog_joystick_read();
 
-#    ifdef CONSOLE_ENABLE
-    if (debug_mouse) dprintf("Raw ] X: %d, Y: %d\n", data.x, data.y);
-#    endif
+    pd_dprintf("Raw ] X: %d, Y: %d\n", data.x, data.y);
 
     mouse_report.x = data.x;
     mouse_report.y = data.y;
@@ -140,11 +136,9 @@ report_mouse_t cirque_pinnacle_get_report(report_mouse_t mouse_report) {
         return mouse_report;
     }
 
-#        if CONSOLE_ENABLE
-    if (debug_mouse && touchData.touchDown) {
-        dprintf("cirque_pinnacle touchData x=%4d y=%4d z=%2d\n", touchData.xValue, touchData.yValue, touchData.zValue);
+    if (touchData.touchDown) {
+        pd_dprintf("cirque_pinnacle touchData x=%4d y=%4d z=%2d\n", touchData.xValue, touchData.yValue, touchData.zValue);
     }
-#        endif
 
     // Scale coordinates to arbitrary X, Y resolution
     cirque_pinnacle_scale_data(&touchData, cirque_pinnacle_get_scale(), cirque_pinnacle_get_scale());
@@ -227,9 +221,7 @@ const pointing_device_driver_t pointing_device_driver = {
 report_mouse_t paw3204_get_report(report_mouse_t mouse_report) {
     report_paw3204_t data = paw3204_read();
     if (data.isMotion) {
-#    ifdef CONSOLE_ENABLE
-        dprintf("Raw ] X: %d, Y: %d\n", data.x, data.y);
-#    endif
+        pd_dprintf("Raw ] X: %d, Y: %d\n", data.x, data.y);
 
         mouse_report.x = data.x;
         mouse_report.y = data.y;
@@ -329,7 +321,7 @@ report_mouse_t pmw33xx_get_report(report_mouse_t mouse_report) {
 
     if (!in_motion) {
         in_motion = true;
-        dprintf("PWM3360 (0): starting motion\n");
+        pd_dprintf("PWM3360 (0): starting motion\n");
     }
 
     mouse_report.x = CONSTRAIN_HID_XY(report.delta_x);
diff --git a/quantum/pointing_device_internal.h b/quantum/pointing_device_internal.h
new file mode 100644
index 0000000000..ef649407ca
--- /dev/null
+++ b/quantum/pointing_device_internal.h
@@ -0,0 +1,14 @@
+// Copyright 2022 Stefan Kerkmann
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#ifdef POINTING_DEVICE_DEBUG
+#    include "debug.h"
+#    include "print.h"
+#    define pd_dprintf(...) dprintf(__VA_ARGS__)
+#else
+#    define pd_dprintf(...) \
+        do {                \
+        } while (0)
+#endif