diff options
| author | Stefan Kerkmann <karlk90@pm.me> | 2025-04-13 18:36:13 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-13 18:36:13 +0200 |
| commit | a7bf8e64a584c9a0930f4aa701a09a6e1de7e117 (patch) | |
| tree | 4f166d22c20c85e48d35e49d61bea24ce98c71e1 /quantum | |
| parent | d0611b0468049f5aba69f1273fb94b8375934237 (diff) | |
[chore]: move and rename mouse/scroll min/max defines (#25141)
* protocol: move {XY/HV}_REPORT_{MIN,MAX} into report.h
..to allow easier re-use in other code implementations.
* protocol: rename {XY/HV}_REPORT_{MIN/MAX} to MOUSE_REPORT_{XY/HV}_{MIN/MAX}
..to avoid naming collisions.
Diffstat (limited to 'quantum')
| -rw-r--r-- | quantum/pointing_device/pointing_device.c | 16 | ||||
| -rw-r--r-- | quantum/pointing_device/pointing_device.h | 10 |
2 files changed, 9 insertions, 17 deletions
diff --git a/quantum/pointing_device/pointing_device.c b/quantum/pointing_device/pointing_device.c index cac2875fc8..e26416f968 100644 --- a/quantum/pointing_device/pointing_device.c +++ b/quantum/pointing_device/pointing_device.c | |||
| @@ -404,10 +404,10 @@ void pointing_device_set_cpi_on_side(bool left, uint16_t cpi) { | |||
| 404 | * @return mouse_hv_report_t clamped value | 404 | * @return mouse_hv_report_t clamped value |
| 405 | */ | 405 | */ |
| 406 | static inline mouse_hv_report_t pointing_device_hv_clamp(hv_clamp_range_t value) { | 406 | static inline mouse_hv_report_t pointing_device_hv_clamp(hv_clamp_range_t value) { |
| 407 | if (value < HV_REPORT_MIN) { | 407 | if (value < MOUSE_REPORT_HV_MIN) { |
| 408 | return HV_REPORT_MIN; | 408 | return MOUSE_REPORT_HV_MIN; |
| 409 | } else if (value > HV_REPORT_MAX) { | 409 | } else if (value > MOUSE_REPORT_HV_MAX) { |
| 410 | return HV_REPORT_MAX; | 410 | return MOUSE_REPORT_HV_MAX; |
| 411 | } else { | 411 | } else { |
| 412 | return value; | 412 | return value; |
| 413 | } | 413 | } |
| @@ -420,10 +420,10 @@ static inline mouse_hv_report_t pointing_device_hv_clamp(hv_clamp_range_t value) | |||
| 420 | * @return mouse_xy_report_t clamped value | 420 | * @return mouse_xy_report_t clamped value |
| 421 | */ | 421 | */ |
| 422 | static inline mouse_xy_report_t pointing_device_xy_clamp(xy_clamp_range_t value) { | 422 | static inline mouse_xy_report_t pointing_device_xy_clamp(xy_clamp_range_t value) { |
| 423 | if (value < XY_REPORT_MIN) { | 423 | if (value < MOUSE_REPORT_XY_MIN) { |
| 424 | return XY_REPORT_MIN; | 424 | return MOUSE_REPORT_XY_MIN; |
| 425 | } else if (value > XY_REPORT_MAX) { | 425 | } else if (value > MOUSE_REPORT_XY_MAX) { |
| 426 | return XY_REPORT_MAX; | 426 | return MOUSE_REPORT_XY_MAX; |
| 427 | } else { | 427 | } else { |
| 428 | return value; | 428 | return value; |
| 429 | } | 429 | } |
diff --git a/quantum/pointing_device/pointing_device.h b/quantum/pointing_device/pointing_device.h index 72188c977d..7bc059e594 100644 --- a/quantum/pointing_device/pointing_device.h +++ b/quantum/pointing_device/pointing_device.h | |||
| @@ -92,27 +92,19 @@ typedef enum { | |||
| 92 | } pointing_device_buttons_t; | 92 | } pointing_device_buttons_t; |
| 93 | 93 | ||
| 94 | #ifdef MOUSE_EXTENDED_REPORT | 94 | #ifdef MOUSE_EXTENDED_REPORT |
| 95 | # define XY_REPORT_MIN INT16_MIN | ||
| 96 | # define XY_REPORT_MAX INT16_MAX | ||
| 97 | typedef int32_t xy_clamp_range_t; | 95 | typedef int32_t xy_clamp_range_t; |
| 98 | #else | 96 | #else |
| 99 | # define XY_REPORT_MIN INT8_MIN | ||
| 100 | # define XY_REPORT_MAX INT8_MAX | ||
| 101 | typedef int16_t xy_clamp_range_t; | 97 | typedef int16_t xy_clamp_range_t; |
| 102 | #endif | 98 | #endif |
| 103 | 99 | ||
| 104 | #ifdef WHEEL_EXTENDED_REPORT | 100 | #ifdef WHEEL_EXTENDED_REPORT |
| 105 | # define HV_REPORT_MIN INT16_MIN | ||
| 106 | # define HV_REPORT_MAX INT16_MAX | ||
| 107 | typedef int32_t hv_clamp_range_t; | 101 | typedef int32_t hv_clamp_range_t; |
| 108 | #else | 102 | #else |
| 109 | # define HV_REPORT_MIN INT8_MIN | ||
| 110 | # define HV_REPORT_MAX INT8_MAX | ||
| 111 | typedef int16_t hv_clamp_range_t; | 103 | typedef int16_t hv_clamp_range_t; |
| 112 | #endif | 104 | #endif |
| 113 | 105 | ||
| 114 | #define CONSTRAIN_HID(amt) ((amt) < INT8_MIN ? INT8_MIN : ((amt) > INT8_MAX ? INT8_MAX : (amt))) | 106 | #define CONSTRAIN_HID(amt) ((amt) < INT8_MIN ? INT8_MIN : ((amt) > INT8_MAX ? INT8_MAX : (amt))) |
| 115 | #define CONSTRAIN_HID_XY(amt) ((amt) < XY_REPORT_MIN ? XY_REPORT_MIN : ((amt) > XY_REPORT_MAX ? XY_REPORT_MAX : (amt))) | 107 | #define CONSTRAIN_HID_XY(amt) ((amt) < MOUSE_REPORT_XY_MIN ? MOUSE_REPORT_XY_MIN : ((amt) > MOUSE_REPORT_XY_MAX ? MOUSE_REPORT_XY_MAX : (amt))) |
| 116 | 108 | ||
| 117 | void pointing_device_init(void); | 109 | void pointing_device_init(void); |
| 118 | bool pointing_device_task(void); | 110 | bool pointing_device_task(void); |
