summaryrefslogtreecommitdiffstats
path: root/quantum/pointing_device/pointing_device.c
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/pointing_device/pointing_device.c')
-rw-r--r--quantum/pointing_device/pointing_device.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/quantum/pointing_device/pointing_device.c b/quantum/pointing_device/pointing_device.c
index 505a7a6ffd..6981f850d0 100644
--- a/quantum/pointing_device/pointing_device.c
+++ b/quantum/pointing_device/pointing_device.c
@@ -144,7 +144,11 @@ __attribute__((weak)) void pointing_device_init(void) {
{
pointing_device_driver.init();
#ifdef POINTING_DEVICE_MOTION_PIN
+# ifdef POINTING_DEVICE_MOTION_PIN_ACTIVE_LOW
setPinInputHigh(POINTING_DEVICE_MOTION_PIN);
+# else
+ setPinInput(POINTING_DEVICE_MOTION_PIN);
+# endif
#endif
}
@@ -166,11 +170,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));
}
@@ -238,7 +240,11 @@ __attribute__((weak)) void pointing_device_task(void) {
# if defined(SPLIT_POINTING_ENABLE)
# error POINTING_DEVICE_MOTION_PIN not supported when sharing the pointing device report between sides.
# endif
+# ifdef POINTING_DEVICE_MOTION_PIN_ACTIVE_LOW
if (!readPin(POINTING_DEVICE_MOTION_PIN))
+# else
+ if (readPin(POINTING_DEVICE_MOTION_PIN))
+# endif
#endif
#if defined(SPLIT_POINTING_ENABLE)
@@ -270,6 +276,10 @@ __attribute__((weak)) void pointing_device_task(void) {
local_mouse_report = pointing_device_adjust_by_defines(local_mouse_report);
local_mouse_report = pointing_device_task_kb(local_mouse_report);
#endif
+ // automatic mouse layer function
+#ifdef POINTING_DEVICE_AUTO_MOUSE_ENABLE
+ pointing_device_task_auto_mouse(local_mouse_report);
+#endif
// combine with mouse report to ensure that the combined is sent correctly
#ifdef MOUSEKEY_ENABLE
report_mouse_t mousekey_report = mousekey_get_report();