summaryrefslogtreecommitdiffstats
path: root/quantum
diff options
context:
space:
mode:
Diffstat (limited to 'quantum')
-rw-r--r--quantum/encoder.c8
-rw-r--r--quantum/pointing_device/pointing_device.c8
-rw-r--r--quantum/pointing_device/pointing_device_drivers.c22
-rw-r--r--quantum/pointing_device_internal.h14
-rw-r--r--quantum/util.h3
5 files changed, 31 insertions, 24 deletions
diff --git a/quantum/encoder.c b/quantum/encoder.c
index 5f8a7ce080..1393e34868 100644
--- a/quantum/encoder.c
+++ b/quantum/encoder.c
@@ -24,7 +24,8 @@
#include <string.h>
#ifndef ENCODER_MAP_KEY_DELAY
-# define ENCODER_MAP_KEY_DELAY 2
+# include "action.h"
+# define ENCODER_MAP_KEY_DELAY TAP_CODE_DELAY
#endif
#if !defined(ENCODER_RESOLUTIONS) && !defined(ENCODER_RESOLUTION)
@@ -143,9 +144,14 @@ void encoder_init(void) {
static void encoder_exec_mapping(uint8_t index, bool clockwise) {
// The delays below cater for Windows and its wonderful requirements.
action_exec(clockwise ? ENCODER_CW_EVENT(index, true) : ENCODER_CCW_EVENT(index, true));
+# if ENCODER_MAP_KEY_DELAY > 0
wait_ms(ENCODER_MAP_KEY_DELAY);
+# endif // ENCODER_MAP_KEY_DELAY > 0
+
action_exec(clockwise ? ENCODER_CW_EVENT(index, false) : ENCODER_CCW_EVENT(index, false));
+# if ENCODER_MAP_KEY_DELAY > 0
wait_ms(ENCODER_MAP_KEY_DELAY);
+# endif // ENCODER_MAP_KEY_DELAY > 0
}
#endif // ENCODER_MAP_ENABLE
diff --git a/quantum/pointing_device/pointing_device.c b/quantum/pointing_device/pointing_device.c
index 505a7a6ffd..ae3f122e89 100644
--- a/quantum/pointing_device/pointing_device.c
+++ b/quantum/pointing_device/pointing_device.c
@@ -166,11 +166,9 @@ __attribute__((weak)) void pointing_device_send(void) {
host_mouse_send(&local_mouse_report);
}
// send it and 0 it out except for buttons, so those stay until they are explicity over-ridden using update_pointing_device
- local_mouse_report.x = 0;
- local_mouse_report.y = 0;
- local_mouse_report.v = 0;
- local_mouse_report.h = 0;
-
+ uint8_t buttons = local_mouse_report.buttons;
+ memset(&local_mouse_report, 0, sizeof(local_mouse_report));
+ local_mouse_report.buttons = buttons;
memcpy(&old_report, &local_mouse_report, sizeof(local_mouse_report));
}
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
diff --git a/quantum/util.h b/quantum/util.h
index ab96ce4bde..21c290013c 100644
--- a/quantum/util.h
+++ b/quantum/util.h
@@ -18,9 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "bitwise.h"
-// convert to L string
-#define LSTR(s) XLSTR(s)
-#define XLSTR(s) L## #s
// convert to string
#define STR(s) XSTR(s)
#define XSTR(s) #s