From f235021abe547f3366459480ba17f548f3119ee2 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Sat, 26 May 2012 15:06:00 +0000 Subject: [PATCH] Fix incorrect definition for the XMEGA Endpoint_BytesInEndpoint() function when used on OUT endpoints. --- LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h b/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h index 720b5f3b4f..23de8fc099 100644 --- a/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h +++ b/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h @@ -274,7 +274,10 @@ static inline uint16_t Endpoint_BytesInEndpoint(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; static inline uint16_t Endpoint_BytesInEndpoint(void) { - return USB_Endpoint_SelectedFIFO->Position; + if (USB_Endpoint_SelectedEndpoint & ENDPOINT_DIR_IN) + return USB_Endpoint_SelectedFIFO->Position; + else + return (USB_Endpoint_SelectedFIFO->Length - USB_Endpoint_SelectedFIFO->Position); } /** Get the endpoint address of the currently selected endpoint. This is typically used to save