/** Sends the next HID report to the host, via the keyboard data endpoint. */\r
static inline void SendNextReport(void)\r
{\r
- USB_MouseReport_Data_t MouseReportData;\r
- bool SendReport = true;\r
+ static USB_MouseReport_Data_t PrevMouseReportData;\r
+ USB_MouseReport_Data_t MouseReportData;\r
+ bool SendReport = true;\r
\r
/* Create the next mouse report for transmission to the host */\r
CreateMouseReport(&MouseReportData);\r
}\r
else\r
{\r
- /* Idle period not elapsed, indicate that a report must not be sent */\r
- SendReport = false;\r
+ /* Idle period not elapsed, indicate that a report must not be sent unless the report has changed */\r
+ SendReport = (memcmp(&PrevMouseReportData, &MouseReportData, sizeof(USB_MouseReport_Data_t)) != 0);\r
}\r
}\r
+\r
+ /* Save the current report data for later comparison to check for changes */\r
+ PrevMouseReportData = MouseReportData;\r
\r
/* Select the Mouse Report Endpoint */\r
Endpoint_SelectEndpoint(MOUSE_EPNUM);\r