[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.
This commit is contained in:
Stefan Kerkmann 2025-04-13 18:36:13 +02:00 committed by GitHub
parent d0611b0468
commit a7bf8e64a5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 23 additions and 23 deletions

View file

@ -404,10 +404,10 @@ void pointing_device_set_cpi_on_side(bool left, uint16_t cpi) {
* @return mouse_hv_report_t clamped value
*/
static inline mouse_hv_report_t pointing_device_hv_clamp(hv_clamp_range_t value) {
if (value < HV_REPORT_MIN) {
return HV_REPORT_MIN;
} else if (value > HV_REPORT_MAX) {
return HV_REPORT_MAX;
if (value < MOUSE_REPORT_HV_MIN) {
return MOUSE_REPORT_HV_MIN;
} else if (value > MOUSE_REPORT_HV_MAX) {
return MOUSE_REPORT_HV_MAX;
} else {
return value;
}
@ -420,10 +420,10 @@ static inline mouse_hv_report_t pointing_device_hv_clamp(hv_clamp_range_t value)
* @return mouse_xy_report_t clamped value
*/
static inline mouse_xy_report_t pointing_device_xy_clamp(xy_clamp_range_t value) {
if (value < XY_REPORT_MIN) {
return XY_REPORT_MIN;
} else if (value > XY_REPORT_MAX) {
return XY_REPORT_MAX;
if (value < MOUSE_REPORT_XY_MIN) {
return MOUSE_REPORT_XY_MIN;
} else if (value > MOUSE_REPORT_XY_MAX) {
return MOUSE_REPORT_XY_MAX;
} else {
return value;
}

View file

@ -92,27 +92,19 @@ typedef enum {
} pointing_device_buttons_t;
#ifdef MOUSE_EXTENDED_REPORT
# define XY_REPORT_MIN INT16_MIN
# define XY_REPORT_MAX INT16_MAX
typedef int32_t xy_clamp_range_t;
#else
# define XY_REPORT_MIN INT8_MIN
# define XY_REPORT_MAX INT8_MAX
typedef int16_t xy_clamp_range_t;
#endif
#ifdef WHEEL_EXTENDED_REPORT
# define HV_REPORT_MIN INT16_MIN
# define HV_REPORT_MAX INT16_MAX
typedef int32_t hv_clamp_range_t;
#else
# define HV_REPORT_MIN INT8_MIN
# define HV_REPORT_MAX INT8_MAX
typedef int16_t hv_clamp_range_t;
#endif
#define CONSTRAIN_HID(amt) ((amt) < INT8_MIN ? INT8_MIN : ((amt) > INT8_MAX ? INT8_MAX : (amt)))
#define CONSTRAIN_HID_XY(amt) ((amt) < XY_REPORT_MIN ? XY_REPORT_MIN : ((amt) > XY_REPORT_MAX ? XY_REPORT_MAX : (amt)))
#define CONSTRAIN_HID_XY(amt) ((amt) < MOUSE_REPORT_XY_MIN ? MOUSE_REPORT_XY_MIN : ((amt) > MOUSE_REPORT_XY_MAX ? MOUSE_REPORT_XY_MAX : (amt)))
void pointing_device_init(void);
bool pointing_device_task(void);