Skip to content
Snippets Groups Projects
Commit b9f3ff39 authored by Dean Camera's avatar Dean Camera
Browse files

Use an early-abort in the USB_DeviceTask() function rather than wrapping the...

Use an early-abort in the USB_DeviceTask() function rather than wrapping the entire implementation in a conditional.
parent c4aeb6d5
Branches
Tags
No related merge requests found
...@@ -60,8 +60,9 @@ void USB_USBTask(void) ...@@ -60,8 +60,9 @@ void USB_USBTask(void)
#if defined(USB_CAN_BE_DEVICE) #if defined(USB_CAN_BE_DEVICE)
static void USB_DeviceTask(void) static void USB_DeviceTask(void)
{ {
if (USB_DeviceState != DEVICE_STATE_Unattached) if (USB_DeviceState == DEVICE_STATE_Unattached)
{ return;
uint8_t PrevEndpoint = Endpoint_GetCurrentEndpoint(); uint8_t PrevEndpoint = Endpoint_GetCurrentEndpoint();
Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP); Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);
...@@ -71,7 +72,6 @@ static void USB_DeviceTask(void) ...@@ -71,7 +72,6 @@ static void USB_DeviceTask(void)
Endpoint_SelectEndpoint(PrevEndpoint); Endpoint_SelectEndpoint(PrevEndpoint);
} }
}
#endif #endif
#if defined(USB_CAN_BE_HOST) #if defined(USB_CAN_BE_HOST)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment