Added new NO_DEVICE_SELF_POWER and NO_DEVICE_REMOTE_WAKEUP compile time options.
[pub/USBasp.git] / LUFA / Drivers / USB / LowLevel / Template / Template_Endpoint_Control_W.c
index 2de7a74..70560cf 100644 (file)
@@ -21,13 +21,16 @@ uint8_t TEMPLATE_FUNC_NAME (const void* Buffer, uint16_t Length)
                  \r
                if (Endpoint_IsINReady())\r
                {\r
-                       while (Length && (Endpoint_BytesInEndpoint() < USB_ControlEndpointSize))\r
+                       uint16_t BytesInEndpoint = Endpoint_BytesInEndpoint();\r
+               \r
+                       while (Length && (BytesInEndpoint < USB_ControlEndpointSize))\r
                        {\r
                                TEMPLATE_TRANSFER_BYTE(DataStream);\r
                                Length--;\r
+                               BytesInEndpoint++;\r
                        }\r
                        \r
-                       LastPacketFull = (Endpoint_BytesInEndpoint() == USB_ControlEndpointSize);\r
+                       LastPacketFull = (BytesInEndpoint == USB_ControlEndpointSize);\r
                        Endpoint_ClearIN();\r
                }\r
        }\r