+/** 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
+ \r
+ /* Create the next mouse report for transmission to the host */\r
+ CreateMouseReport(&MouseReportData);\r
+ \r
+ /* Check if the idle period is set*/\r
+ if (IdleCount)\r
+ {\r
+ /* Determine if the idle period has elapsed */\r
+ if (!(IdleMSRemaining))\r
+ {\r
+ /* Reset the idle time remaining counter, must multiply by 4 to get the duration in milliseconds */\r
+ IdleMSRemaining = (IdleCount << 2); \r
+ }\r
+ else\r
+ {\r
+ /* Idle period not elapsed, indicate that a report must not be sent */\r
+ SendReport = false;\r
+ }\r
+ }\r
+ \r
+ /* Select the Mouse Report Endpoint */\r
+ Endpoint_SelectEndpoint(MOUSE_EPNUM);\r
+\r
+ /* Check if Mouse Endpoint Ready for Read/Write and if we should send a new report */\r
+ if (Endpoint_ReadWriteAllowed() && SendReport)\r
+ {\r
+ /* Write Mouse Report Data */\r
+ Endpoint_Write_Stream_LE(&MouseReportData, sizeof(MouseReportData));\r
+ \r
+ /* Finalize the stream transfer to send the last packet */\r
+ Endpoint_ClearCurrentBank();\r
+ }\r
+}\r
+\r