Fixed Mass Storage Host Class driver and Low Level demo not clearing the error condit...
[pub/USBasp.git] / LUFA / Drivers / USB / LowLevel / Template / Template_Endpoint_Control_W.c
index 6c1445e..2de7a74 100644 (file)
@@ -1,11 +1,13 @@
-uint8_t TEMPLATE_FUNC_NAME (void* Buffer, uint16_t Length)\r
+uint8_t TEMPLATE_FUNC_NAME (const void* Buffer, uint16_t Length)\r
 {\r
-       uint8_t* DataStream     = (uint8_t*)(Buffer + TEMPLATE_BUFFER_OFFSET(Length));\r
+       uint8_t* DataStream     = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length));\r
        bool     LastPacketFull = false;\r
        \r
        if (Length > USB_ControlRequest.wLength)\r
          Length = USB_ControlRequest.wLength;\r
-       \r
+       else if (!(Length))\r
+         Endpoint_ClearIN();\r
+\r
        while (Length || LastPacketFull)\r
        {\r
                if (Endpoint_IsSETUPReceived())\r