Update DevChapter9.c - use the Endpoint_ClearStatusStage() function where possible...
[pub/USBasp.git] / LUFA / Drivers / USB / LowLevel / DevChapter9.c
index 50afb61..89c4e29 100644 (file)
@@ -121,7 +121,7 @@ static void USB_Device_SetAddress(void)
 \r
        Endpoint_ClearSETUP();\r
        \r
-       Endpoint_ClearIN();\r
+       Endpoint_ClearStatusStage();\r
        \r
        while (!(Endpoint_IsINReady()))\r
        {\r
@@ -190,7 +190,7 @@ static void USB_Device_SetConfiguration(void)
 \r
        USB_ConfigurationNumber = (uint8_t)USB_ControlRequest.wValue;\r
 \r
-       Endpoint_ClearIN();\r
+       Endpoint_ClearStatusStage();\r
 \r
        if (USB_ConfigurationNumber)\r
          USB_DeviceState = DEVICE_STATE_Configured;\r
@@ -205,16 +205,9 @@ void USB_Device_GetConfiguration(void)
        Endpoint_ClearSETUP();\r
 \r
        Endpoint_Write_Byte(USB_ConfigurationNumber);\r
-       \r
        Endpoint_ClearIN();\r
 \r
-       while (!(Endpoint_IsOUTReceived()))\r
-       {\r
-               if (USB_DeviceState == DEVICE_STATE_Unattached)\r
-                 return;       \r
-       }\r
-\r
-       Endpoint_ClearOUT();\r
+       Endpoint_ClearStatusStage();\r
 }\r
 \r
 #if !defined(NO_INTERNAL_SERIAL) && (defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR))\r
@@ -251,7 +244,9 @@ static void USB_Device_GetInternalSerialDescriptor(void)
        }\r
        \r
        Endpoint_ClearSETUP();\r
+\r
        Endpoint_Write_Control_Stream_LE(&SignatureDescriptor, sizeof(SignatureDescriptor));\r
+\r
        Endpoint_ClearOUT();\r
 }\r
 #endif\r
@@ -334,16 +329,9 @@ static void USB_Device_GetStatus(void)
        Endpoint_ClearSETUP();\r
 \r
        Endpoint_Write_Word_LE(CurrentStatus);\r
-\r
        Endpoint_ClearIN();\r
        \r
-       while (!(Endpoint_IsOUTReceived()))\r
-       {\r
-               if (USB_DeviceState == DEVICE_STATE_Unattached)\r
-                 return;       \r
-       }\r
-       \r
-       Endpoint_ClearOUT();\r
+       Endpoint_ClearStatusStage();\r
 }\r
 \r
 static void USB_Device_ClearSetFeature(void)\r
@@ -391,7 +379,7 @@ static void USB_Device_ClearSetFeature(void)
 \r
        Endpoint_ClearSETUP();\r
 \r
-       Endpoint_ClearIN();\r
+       Endpoint_ClearStatusStage();\r
 }\r
 \r
 #endif\r