summaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
authoreynsai <47629346+eynsai@users.noreply.github.com>2025-04-22 18:04:31 -0400
committerGitHub <noreply@github.com>2025-04-23 00:04:31 +0200
commit7a2cd0fa962eb5e6e18ce8b0213a7171bc823c1f (patch)
treed7c62b67ba4d9402b822768d7013803d99cb9484 /quantum
parent83818d1d6f7d1f590946756ad552e407bf9a2e1f (diff)
High resolution scrolling (without feature report parsing) (#24423)
* hires scrolling without feature report parsing * fix valid range for exponent * fix incorrect minimum exponent value documentation
Diffstat (limited to 'quantum')
-rw-r--r--quantum/pointing_device/pointing_device.c19
-rw-r--r--quantum/pointing_device/pointing_device.h4
2 files changed, 23 insertions, 0 deletions
diff --git a/quantum/pointing_device/pointing_device.c b/quantum/pointing_device/pointing_device.c
index e26416f968..5ee65c9c61 100644
--- a/quantum/pointing_device/pointing_device.c
+++ b/quantum/pointing_device/pointing_device.c
@@ -25,6 +25,10 @@
25# include "mousekey.h" 25# include "mousekey.h"
26#endif 26#endif
27 27
28#ifdef POINTING_DEVICE_HIRES_SCROLL_ENABLE
29# include "usb_descriptor_common.h"
30#endif
31
28#if (defined(POINTING_DEVICE_ROTATION_90) + defined(POINTING_DEVICE_ROTATION_180) + defined(POINTING_DEVICE_ROTATION_270)) > 1 32#if (defined(POINTING_DEVICE_ROTATION_90) + defined(POINTING_DEVICE_ROTATION_180) + defined(POINTING_DEVICE_ROTATION_270)) > 1
29# error More than one rotation selected. This is not supported. 33# error More than one rotation selected. This is not supported.
30#endif 34#endif
@@ -78,6 +82,9 @@ uint16_t pointing_device_get_shared_cpi(void) {
78 82
79static report_mouse_t local_mouse_report = {}; 83static report_mouse_t local_mouse_report = {};
80static bool pointing_device_force_send = false; 84static bool pointing_device_force_send = false;
85#ifdef POINTING_DEVICE_HIRES_SCROLL_ENABLE
86static uint16_t hires_scroll_resolution;
87#endif
81 88
82#define POINTING_DEVICE_DRIVER_CONCAT(name) name##_pointing_device_driver 89#define POINTING_DEVICE_DRIVER_CONCAT(name) name##_pointing_device_driver
83#define POINTING_DEVICE_DRIVER(name) POINTING_DEVICE_DRIVER_CONCAT(name) 90#define POINTING_DEVICE_DRIVER(name) POINTING_DEVICE_DRIVER_CONCAT(name)
@@ -176,6 +183,12 @@ __attribute__((weak)) void pointing_device_init(void) {
176# endif 183# endif
177#endif 184#endif
178 } 185 }
186#ifdef POINTING_DEVICE_HIRES_SCROLL_ENABLE
187 hires_scroll_resolution = POINTING_DEVICE_HIRES_SCROLL_MULTIPLIER;
188 for (int i = 0; i < POINTING_DEVICE_HIRES_SCROLL_EXPONENT; i++) {
189 hires_scroll_resolution *= 10;
190 }
191#endif
179 192
180 pointing_device_init_kb(); 193 pointing_device_init_kb();
181 pointing_device_init_user(); 194 pointing_device_init_user();
@@ -523,3 +536,9 @@ __attribute__((weak)) void pointing_device_keycode_handler(uint16_t keycode, boo
523 pointing_device_send(); 536 pointing_device_send();
524 } 537 }
525} 538}
539
540#ifdef POINTING_DEVICE_HIRES_SCROLL_ENABLE
541uint16_t pointing_device_get_hires_scroll_resolution(void) {
542 return hires_scroll_resolution;
543}
544#endif \ No newline at end of file
diff --git a/quantum/pointing_device/pointing_device.h b/quantum/pointing_device/pointing_device.h
index 7bc059e594..d8b583c87e 100644
--- a/quantum/pointing_device/pointing_device.h
+++ b/quantum/pointing_device/pointing_device.h
@@ -122,6 +122,10 @@ uint8_t pointing_device_handle_buttons(uint8_t buttons, bool pressed, poi
122report_mouse_t pointing_device_adjust_by_defines(report_mouse_t mouse_report); 122report_mouse_t pointing_device_adjust_by_defines(report_mouse_t mouse_report);
123void pointing_device_keycode_handler(uint16_t keycode, bool pressed); 123void pointing_device_keycode_handler(uint16_t keycode, bool pressed);
124 124
125#ifdef POINTING_DEVICE_HIRES_SCROLL_ENABLE
126uint16_t pointing_device_get_hires_scroll_resolution(void);
127#endif
128
125#if defined(SPLIT_POINTING_ENABLE) 129#if defined(SPLIT_POINTING_ENABLE)
126void pointing_device_set_shared_report(report_mouse_t report); 130void pointing_device_set_shared_report(report_mouse_t report);
127uint16_t pointing_device_get_shared_cpi(void); 131uint16_t pointing_device_get_shared_cpi(void);