Ensure that the previous HID reports in the HID device class driver are kept per...
authorDean Camera <dean@fourwalledcubicle.com>
Thu, 30 Jul 2009 14:40:42 +0000 (14:40 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Thu, 30 Jul 2009 14:40:42 +0000 (14:40 +0000)
LUFA/Drivers/USB/Class/Device/HID.c
LUFA/Drivers/USB/Class/Device/HID.h

index 4c13436..bfe97ff 100644 (file)
@@ -150,8 +150,6 @@ bool HID_Device_ConfigureEndpoints(USB_ClassInfo_HID_Device_t* const HIDInterfac
                \r
 void HID_Device_USBTask(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo)\r
 {\r
-       static uint8_t PreviousReportINData[HID_MAX_REPORT_SIZE];\r
-\r
        if (USB_DeviceState != DEVICE_STATE_Configured)\r
          return;\r
 \r
@@ -167,10 +165,10 @@ void HID_Device_USBTask(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo)
 \r
                ReportINSize  = CALLBACK_HID_Device_CreateHIDReport(HIDInterfaceInfo, &ReportID, ReportINData);\r
 \r
-               bool StatesChanged     = (memcmp(ReportINData, PreviousReportINData, ReportINSize) != 0);\r
+               bool StatesChanged     = (memcmp(ReportINData, HIDInterfaceInfo->State.PreviousReportINData, ReportINSize) != 0);\r
                bool IdlePeriodElapsed = (HIDInterfaceInfo->State.IdleCount && !(HIDInterfaceInfo->State.IdleMSRemaining));\r
                \r
-               memcpy(PreviousReportINData, ReportINData, ReportINSize);\r
+               memcpy(HIDInterfaceInfo->State.PreviousReportINData, ReportINData, ReportINSize);\r
 \r
                if (ReportINSize && (StatesChanged || IdlePeriodElapsed))\r
                {\r
index 61f43a1..ae68134 100644 (file)
@@ -88,7 +88,9 @@
                                        bool     UsingReportProtocol; /**< Indicates if the HID interface is set to Boot or Report protocol mode */\r
                                        uint16_t IdleCount; /**< Report idle period, in mS, set by the host */\r
                                        uint16_t IdleMSRemaining; /**< Total number of mS remaining before the idle period elapsed - this should be\r
-                                                                                          *   decremented by the user application if non-zero each millisecond */                      \r
+                                                                                          *   decremented by the user application if non-zero each millisecond */      \r
+\r
+                                       uint8_t PreviousReportINData[HID_MAX_REPORT_SIZE]; /**< Previously generated report from the HID interface */\r
                                } State; /**< State data for the USB class interface within the device. All elements in this section\r
                                          *   are reset to their defaults when the interface is enumerated.\r
                                          */\r