/* Sends the next HID report to the host, via the keyboard data endpoint.  */
void SendNextReport(void)
/* Sends the next HID report to the host, via the keyboard data endpoint.  */
void SendNextReport(void)
{
	static USB_KeyboardReport_Data_t PrevKeyboardReportData;
	USB_KeyboardReport_Data_t        KeyboardReportData;
	bool                             SendReport = false;
	CreateKeyboardReport(&KeyboardReportData);
	if (IdleCount && (!(IdleMSRemaining)))
	{
		IdleMSRemaining = IdleCount;
		SendReport = true;
	}
	else
	{
		SendReport = (memcmp(&PrevKeyboardReportData, &KeyboardReportData, sizeof(USB_KeyboardReport_Data_t)) != 0);
	}
	Endpoint_SelectEndpoint(KEYBOARD_IN_EPADDR);
	if (Endpoint_IsReadWriteAllowed() && SendReport)
	{
		PrevKeyboardReportData = KeyboardReportData;
		Endpoint_Write_Stream_LE(&KeyboardReportData, sizeof(KeyboardReportData), NULL);
		Endpoint_ClearIN();
	}
}