diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2012-09-01 22:55:56 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2012-09-01 22:55:56 +0000 |
commit | b9f3ff39a41c5dea00a651b7efe75f0f15a71ed1 (patch) | |
tree | 9d31ca7618fc5eed8d51cd8299c08a20b1b2dec6 | |
parent | c4aeb6d5abc2a42f69388e33394a6f43740486ef (diff) | |
download | lufa-b9f3ff39a41c5dea00a651b7efe75f0f15a71ed1.tar.gz lufa-b9f3ff39a41c5dea00a651b7efe75f0f15a71ed1.tar.bz2 lufa-b9f3ff39a41c5dea00a651b7efe75f0f15a71ed1.zip |
Use an early-abort in the USB_DeviceTask() function rather than wrapping the entire implementation in a conditional.
-rw-r--r-- | LUFA/Drivers/USB/Core/USBTask.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/LUFA/Drivers/USB/Core/USBTask.c b/LUFA/Drivers/USB/Core/USBTask.c index 71ae47d02..be14611aa 100644 --- a/LUFA/Drivers/USB/Core/USBTask.c +++ b/LUFA/Drivers/USB/Core/USBTask.c @@ -60,17 +60,17 @@ void USB_USBTask(void) #if defined(USB_CAN_BE_DEVICE) static void USB_DeviceTask(void) { - if (USB_DeviceState != DEVICE_STATE_Unattached) - { - uint8_t PrevEndpoint = Endpoint_GetCurrentEndpoint(); + if (USB_DeviceState == DEVICE_STATE_Unattached) + return; - Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP); + uint8_t PrevEndpoint = Endpoint_GetCurrentEndpoint(); - if (Endpoint_IsSETUPReceived()) - USB_Device_ProcessControlRequest(); + Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP); - Endpoint_SelectEndpoint(PrevEndpoint); - } + if (Endpoint_IsSETUPReceived()) + USB_Device_ProcessControlRequest(); + + Endpoint_SelectEndpoint(PrevEndpoint); } #endif |