Endpoint_ClearSETUP();\r
\r
/* Wait until the LED report has been sent by the host */\r
- while (!(Endpoint_IsOUTReceived()));\r
+ while (!(Endpoint_IsOUTReceived()))\r
+ {\r
+ if (USB_DeviceState == DEVICE_STATE_Unattached)\r
+ return;\r
+ }\r
\r
/* Read in the LED report from the host */\r
uint8_t LEDStatus = Endpoint_Read_Byte();\r
/* Clear the endpoint data */\r
Endpoint_ClearOUT();\r
\r
- /* Acknowledge status stage */\r
- while (!(Endpoint_IsINReady()));\r
- Endpoint_ClearIN();\r
+ Endpoint_ClearStatusStage();\r
}\r
\r
break;\r
uint8_t JoyStatus_LCL = Joystick_GetStatus();\r
\r
/* Device must be connected and configured for the task to run */\r
- if (!(USB_IsConnected) || !(USB_ConfigurationNumber))\r
+ if (USB_DeviceState != DEVICE_STATE_Configured)\r
return;\r
\r
/* Check if board button is not pressed, if so mouse mode enabled */\r
uint8_t JoyStatus_LCL = Joystick_GetStatus();\r
\r
/* Device must be connected and configured for the task to run */\r
- if (!(USB_IsConnected) || !(USB_ConfigurationNumber))\r
+ if (USB_DeviceState != DEVICE_STATE_Configured)\r
return;\r
\r
/* Check if board button is pressed, if so mouse mode enabled */\r