X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/a54ed0085b29f81946f3652bd412103292da7589..4f74075fad7f1e7a35d04ff534d9d6a57d2b97fc:/LUFA/Drivers/USB/HighLevel/USBTask.c diff --git a/LUFA/Drivers/USB/HighLevel/USBTask.c b/LUFA/Drivers/USB/HighLevel/USBTask.c index 894171f24..f1277b9a7 100644 --- a/LUFA/Drivers/USB/HighLevel/USBTask.c +++ b/LUFA/Drivers/USB/HighLevel/USBTask.c @@ -33,15 +33,17 @@ #define INCLUDE_FROM_USBTASK_C #include "USBTask.h" -volatile bool USB_IsSuspended; -volatile bool USB_IsConnected; volatile bool USB_IsInitialized; USB_Request_Header_t USB_ControlRequest; -#if defined(USB_CAN_BE_HOST) +#if defined(USB_CAN_BE_HOST) && !defined(HOST_STATE_AS_GPIOR) volatile uint8_t USB_HostState; #endif +#if defined(USB_CAN_BE_DEVICE) && !defined(DEVICE_STATE_AS_GPIOR) +volatile uint8_t USB_DeviceState; +#endif + void USB_USBTask(void) { #if defined(USB_HOST_ONLY) @@ -59,19 +61,14 @@ void USB_USBTask(void) #if defined(USB_CAN_BE_DEVICE) static void USB_DeviceTask(void) { - if (USB_IsConnected) + if (USB_DeviceState != DEVICE_STATE_Unattached) { uint8_t PrevEndpoint = Endpoint_GetCurrentEndpoint(); Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP); if (Endpoint_IsSETUPReceived()) - { - ATOMIC_BLOCK(ATOMIC_RESTORESTATE) - { - USB_Device_ProcessControlPacket(); - } - } + USB_Device_ProcessControlRequest(); Endpoint_SelectEndpoint(PrevEndpoint); }