Mark build test makefiles as being incompatible with parallel make builds, as they...
[pub/USBasp.git] / LUFA / Drivers / USB / Class / Device / HIDClassDevice.c
index 9b5a7dd..e4b5653 100644 (file)
@@ -1,13 +1,13 @@
 /*
              LUFA Library
-     Copyright (C) Dean Camera, 2011.
+     Copyright (C) Dean Camera, 2012.
 
   dean [at] fourwalledcubicle [dot] com
            www.lufa-lib.org
 */
 
 /*
-  Copyright 2011  Dean Camera (dean [at] fourwalledcubicle [dot] com)
+  Copyright 2012  Dean Camera (dean [at] fourwalledcubicle [dot] com)
 
   Permission to use, copy, modify, distribute, and sell this
   software and its documentation for any purpose is hereby granted
@@ -64,7 +64,7 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter
                                        memcpy(HIDInterfaceInfo->Config.PrevReportINBuffer, ReportData,
                                               HIDInterfaceInfo->Config.PrevReportINBufferSize);
                                }
-                               
+
                                Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);
 
                                Endpoint_ClearSETUP();
@@ -84,7 +84,7 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter
                                Endpoint_ClearSETUP();
                                Endpoint_Read_Control_Stream_LE(ReportData, ReportSize);
                                Endpoint_ClearIN();
-                               
+
                                CALLBACK_HID_Device_ProcessHIDReport(HIDInterfaceInfo, ReportID, ReportType,
                                                                     &ReportData[ReportID ? 1 : 0], ReportSize - (ReportID ? 1 : 0));
                        }
@@ -141,13 +141,11 @@ bool HID_Device_ConfigureEndpoints(USB_ClassInfo_HID_Device_t* const HIDInterfac
        HIDInterfaceInfo->State.UsingReportProtocol = true;
        HIDInterfaceInfo->State.IdleCount           = 500;
 
-       if (!(Endpoint_ConfigureEndpoint(HIDInterfaceInfo->Config.ReportINEndpointNumber, EP_TYPE_INTERRUPT,
-                                                                        ENDPOINT_DIR_IN, HIDInterfaceInfo->Config.ReportINEndpointSize,
-                                                                        HIDInterfaceInfo->Config.ReportINEndpointDoubleBank ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
-       {
-               return false;
-       }
+       HIDInterfaceInfo->Config.ReportINEndpoint.Type = EP_TYPE_INTERRUPT;
 
+       if (!(Endpoint_ConfigureEndpointTable(&HIDInterfaceInfo->Config.ReportINEndpoint, 1)))
+         return false; 
+       
        return true;
 }
 
@@ -156,7 +154,10 @@ void HID_Device_USBTask(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo)
        if (USB_DeviceState != DEVICE_STATE_Configured)
          return;
 
-       Endpoint_SelectEndpoint(HIDInterfaceInfo->Config.ReportINEndpointNumber);
+       if (HIDInterfaceInfo->State.PrevFrameNum == USB_Device_GetFrameNumber())
+         return;
+         
+       Endpoint_SelectEndpoint(HIDInterfaceInfo->Config.ReportINEndpoint.Address);
 
        if (Endpoint_IsReadWriteAllowed())
        {
@@ -181,7 +182,7 @@ void HID_Device_USBTask(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo)
                {
                        HIDInterfaceInfo->State.IdleMSRemaining = HIDInterfaceInfo->State.IdleCount;
 
-                       Endpoint_SelectEndpoint(HIDInterfaceInfo->Config.ReportINEndpointNumber);
+                       Endpoint_SelectEndpoint(HIDInterfaceInfo->Config.ReportINEndpoint.Address);
 
                        if (ReportID)
                          Endpoint_Write_8(ReportID);
@@ -190,6 +191,8 @@ void HID_Device_USBTask(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo)
 
                        Endpoint_ClearIN();
                }
+               
+               HIDInterfaceInfo->State.PrevFrameNum = USB_Device_GetFrameNumber();
        }
 }