diff options
author | Dean Camera <[email protected]> | 2012-02-09 20:30:27 +0000 |
---|---|---|
committer | Dean Camera <[email protected]> | 2012-02-09 20:30:27 +0000 |
commit | 2180f57d17a5589291eaf77db999f61a883ef3b6 (patch) | |
tree | 7b77dd0aea677621d885febca71948520c5f5da4 /LUFA/Drivers/USB/Class/Device/HIDClassDevice.c | |
parent | 385ffb6de3cc85462be82f14eeb580d6b66bc5e7 (diff) | |
download | qmk_firmware-2180f57d17a5589291eaf77db999f61a883ef3b6.tar.gz qmk_firmware-2180f57d17a5589291eaf77db999f61a883ef3b6.zip |
Altered the HID class driver to only try to construct at maximum one packet per USB frame, to reduce CPU usage.
Diffstat (limited to 'LUFA/Drivers/USB/Class/Device/HIDClassDevice.c')
-rw-r--r-- | LUFA/Drivers/USB/Class/Device/HIDClassDevice.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/LUFA/Drivers/USB/Class/Device/HIDClassDevice.c b/LUFA/Drivers/USB/Class/Device/HIDClassDevice.c index d756b092eb..5c8d878e7e 100644 --- a/LUFA/Drivers/USB/Class/Device/HIDClassDevice.c +++ b/LUFA/Drivers/USB/Class/Device/HIDClassDevice.c @@ -156,6 +156,9 @@ void HID_Device_USBTask(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo) if (USB_DeviceState != DEVICE_STATE_Configured) return; + if (HIDInterfaceInfo->State.PrevFrameNum == USB_Device_GetFrameNumber()) + return; + Endpoint_SelectEndpoint(HIDInterfaceInfo->Config.ReportINEndpointNumber); if (Endpoint_IsReadWriteAllowed()) @@ -190,6 +193,8 @@ void HID_Device_USBTask(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo) Endpoint_ClearIN(); } + + HIDInterfaceInfo->State.PrevFrameNum = USB_Device_GetFrameNumber(); } } |