From 8acff8aaf7120ceea806baf1904453ff34a8af1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Monda?= Date: Wed, 2 Mar 2016 11:45:05 +0100 Subject: [PATCH] Extract USB_MOUSE_REPORT_DESCRIPTOR_BUTTONS_PADDING --- right/usb_descriptor_mouse_report.c | 2 +- right/usb_descriptor_mouse_report.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/right/usb_descriptor_mouse_report.c b/right/usb_descriptor_mouse_report.c index 2c42bec..8e2966d 100644 --- a/right/usb_descriptor_mouse_report.c +++ b/right/usb_descriptor_mouse_report.c @@ -21,7 +21,7 @@ uint8_t UsbMouseReportDescriptor[USB_MOUSE_REPORT_DESCRIPTOR_LENGTH] = { // Mouse buttons padding HID_RI_REPORT_COUNT(8, 0x01), - HID_RI_REPORT_SIZE(8, (USB_MOUSE_REPORT_DESCRIPTOR_BUTTONS % 8) ? (8 - (USB_MOUSE_REPORT_DESCRIPTOR_BUTTONS % 8)) : 0), + HID_RI_REPORT_SIZE(8, USB_MOUSE_REPORT_DESCRIPTOR_BUTTONS_PADDING), HID_RI_INPUT(8, HID_IOF_CONSTANT), // Mouse X and Y coordinates diff --git a/right/usb_descriptor_mouse_report.h b/right/usb_descriptor_mouse_report.h index 3994a75..657c494 100644 --- a/right/usb_descriptor_mouse_report.h +++ b/right/usb_descriptor_mouse_report.h @@ -11,6 +11,9 @@ #define USB_MOUSE_REPORT_DESCRIPTOR_MAX_AXIS_PHYSICAL_VALUE 4096 #define USB_MOUSE_REPORT_DESCRIPTOR_BUTTONS 8 + #define USB_MOUSE_REPORT_DESCRIPTOR_BUTTONS_PADDING ((USB_MOUSE_REPORT_DESCRIPTOR_BUTTONS % 8) \ + ? (8 - (USB_MOUSE_REPORT_DESCRIPTOR_BUTTONS % 8)) \ + : 0) // Variables: extern uint8_t UsbMouseReportDescriptor[USB_MOUSE_REPORT_DESCRIPTOR_LENGTH];