.NotificationEndpointNumber = CDC2_NOTIFICATION_EPNUM,\r
.NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE,\r
},\r
- \r
- .State =\r
- {\r
- // Leave all state values to their defaults\r
- }\r
};\r
\r
/** Main program entry point. This routine contains the overall program flow, including initial\r
/** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */\r
ISR(TIMER0_COMPA_vect, ISR_BLOCK)\r
{\r
- if (Generic_HID_Interface.State.IdleMSRemaining)\r
- Generic_HID_Interface.State.IdleMSRemaining--;\r
+ HID_Device_MillisecondElapsed(&Generic_HID_Interface);\r
}\r
\r
/** HID class driver callback function for the creation of HID reports to the host.\r
/** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */\r
ISR(TIMER0_COMPA_vect, ISR_BLOCK)\r
{\r
- if (Joystick_HID_Interface.State.IdleMSRemaining)\r
- Joystick_HID_Interface.State.IdleMSRemaining--;\r
+ HID_Device_MillisecondElapsed(&Joystick_HID_Interface);\r
}\r
\r
/** HID class driver callback function for the creation of HID reports to the host.\r
/** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */\r
ISR(TIMER0_COMPA_vect, ISR_BLOCK)\r
{\r
- if (Keyboard_HID_Interface.State.IdleMSRemaining)\r
- Keyboard_HID_Interface.State.IdleMSRemaining--;\r
+ HID_Device_MillisecondElapsed(&Keyboard_HID_Interface);\r
}\r
\r
/** HID class driver callback function for the creation of HID reports to the host.\r
\r
.ReportINEndpointNumber = MOUSE_IN_EPNUM,\r
.ReportINEndpointSize = HID_EPSIZE,\r
- },\r
- \r
- .State =\r
- {\r
- // Leave all state values to their defaults\r
- } \r
+ }, \r
};\r
\r
/** Main program entry point. This routine contains the overall program flow, including initial\r
/** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */\r
ISR(TIMER0_COMPA_vect, ISR_BLOCK)\r
{\r
- if (Keyboard_HID_Interface.State.IdleMSRemaining)\r
- Keyboard_HID_Interface.State.IdleMSRemaining--;\r
-\r
- if (Mouse_HID_Interface.State.IdleMSRemaining)\r
- Mouse_HID_Interface.State.IdleMSRemaining--;\r
+ HID_Device_MillisecondElapsed(&Keyboard_HID_Interface);\r
+ HID_Device_MillisecondElapsed(&Mouse_HID_Interface);\r
}\r
\r
/** HID class driver callback function for the creation of HID reports to the host.\r
/** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */\r
ISR(TIMER0_COMPA_vect, ISR_BLOCK)\r
{\r
- if (Mouse_HID_Interface.State.IdleMSRemaining)\r
- Mouse_HID_Interface.State.IdleMSRemaining--;\r
+ HID_Device_MillisecondElapsed(&Mouse_HID_Interface);\r
}\r
\r
/** HID class driver callback function for the creation of HID reports to the host.\r
}\r
}\r
\r
+void HID_Device_MillisecondElapsed(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo)\r
+{\r
+ if (HIDInterfaceInfo->State.IdleMSRemaining)\r
+ HIDInterfaceInfo->State.IdleMSRemaining--;\r
+}\r
+\r
#endif\r
*/\r
void HID_Device_USBTask(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo);\r
\r
+ /** Indicates that a millisecond of idle time has elapsed on the given HID interface, and the interface's idle count should be\r
+ * decremented. This should be called once per millisecond so that hardware key-repeats function correctly.\r
+ *\r
+ * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state.\r
+ */\r
+ void HID_Device_MillisecondElapsed(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo);\r
+ \r
/** HID class driver callback for the user creation of a HID input report. This callback may fire in response to either\r
* HID class control requests from the host, or by the normal HID endpoint polling procedure. Inside this callback the\r
* user is responsible for the creation of the next HID input report to be sent to the host.\r
/** Timer 0 CTC ISR, firing once each millisecond to keep track of elapsed idle time in the HID interface. */\r
ISR(TIMER0_COMPA_vect, ISR_BLOCK)\r
{\r
- if (Keyboard_HID_Interface.State.IdleMSRemaining)\r
- Keyboard_HID_Interface.State.IdleMSRemaining--;\r
+ HID_Device_MillisecondElapsed(&Keyboard_HID_Interface);\r
}\r
\r
/** HID Class driver callback function for the creation of a HID report for the host.\r