/** Function to manage HID report generation and transmission to the host, when in report mode. */\r
void HID_Task(void)\r
{\r
- /* Check if the USB system is connected to a host */\r
- if (USB_IsConnected)\r
- {\r
- /* Send the next keypress report to the host */\r
- SendNextReport();\r
+ /* Device must be connected and configured for the task to run */\r
+ if (!(USB_IsConnected) || !(USB_ConfigurationNumber))\r
+ return;\r
+ \r
+ /* Send the next keypress report to the host */\r
+ SendNextReport();\r
\r
- /* Process the LED report sent from the host */\r
- ReceiveNextReport();\r
- }\r
+ /* Process the LED report sent from the host */\r
+ ReceiveNextReport();\r
}\r