diff options
Diffstat (limited to 'Demos/Device/ClassDriver/Keyboard')
-rw-r--r-- | Demos/Device/ClassDriver/Keyboard/Keyboard.c | 34 | ||||
-rw-r--r-- | Demos/Device/ClassDriver/Keyboard/Keyboard.h | 5 |
2 files changed, 23 insertions, 16 deletions
diff --git a/Demos/Device/ClassDriver/Keyboard/Keyboard.c b/Demos/Device/ClassDriver/Keyboard/Keyboard.c index 7318edb8c7..f44a934516 100644 --- a/Demos/Device/ClassDriver/Keyboard/Keyboard.c +++ b/Demos/Device/ClassDriver/Keyboard/Keyboard.c @@ -41,16 +41,22 @@ * passed to all HID Class driver functions, so that multiple instances of the same class
* within a device can be differentiated from one another.
*/
-USB_ClassInfo_HID_t Keyboard_HID_Interface =
- {
- .InterfaceNumber = 0,
-
- .ReportINEndpointNumber = KEYBOARD_EPNUM,
- .ReportINEndpointSize = KEYBOARD_EPSIZE,
-
- .ReportINBufferSize = sizeof(USB_KeyboardReport_Data_t),
-
- .IdleCount = 500,
+USB_ClassInfo_HID_Device_t Keyboard_HID_Interface =
+ {
+ .Config =
+ {
+ .InterfaceNumber = 0,
+
+ .ReportINEndpointNumber = KEYBOARD_EPNUM,
+ .ReportINEndpointSize = KEYBOARD_EPSIZE,
+
+ .ReportINBufferSize = sizeof(USB_KeyboardReport_Data_t),
+ },
+
+ .State =
+ {
+ .IdleCount = 500,
+ }
};
/** Main program entry point. This routine contains the overall program flow, including initial
@@ -122,8 +128,8 @@ void EVENT_USB_UnhandledControlPacket(void) /** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */
ISR(TIMER0_COMPA_vect, ISR_BLOCK)
{
- if (Keyboard_HID_Interface.IdleMSRemaining)
- Keyboard_HID_Interface.IdleMSRemaining--;
+ if (Keyboard_HID_Interface.State.IdleMSRemaining)
+ Keyboard_HID_Interface.State.IdleMSRemaining--;
}
/** HID class driver callback function for the creation of HID reports to the host.
@@ -134,7 +140,7 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK) *
* \return Number of bytes written in the report (or zero if no report is to be sent
*/
-uint16_t CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t* ReportID, void* ReportData)
+uint16_t CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo, uint8_t* ReportID, void* ReportData)
{
USB_KeyboardReport_Data_t* KeyboardReport = (USB_KeyboardReport_Data_t*)ReportData;
@@ -167,7 +173,7 @@ uint16_t CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_t* HIDInterfaceIn * \param ReportData Pointer to a buffer where the created report has been stored
* \param ReportSize Size in bytes of the received HID report
*/
-void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t ReportID,
+void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo, uint8_t ReportID,
void* ReportData, uint16_t ReportSize)
{
uint8_t LEDMask = LEDS_NO_LEDS;
diff --git a/Demos/Device/ClassDriver/Keyboard/Keyboard.h b/Demos/Device/ClassDriver/Keyboard/Keyboard.h index 74802fdd98..3dc7eaeec5 100644 --- a/Demos/Device/ClassDriver/Keyboard/Keyboard.h +++ b/Demos/Device/ClassDriver/Keyboard/Keyboard.h @@ -86,8 +86,9 @@ void EVENT_USB_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void);
- uint16_t CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t* ReportID, void* ReportData);
- void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, uint8_t ReportID,
+ uint16_t CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo, uint8_t* ReportID,
+ void* ReportData);
+ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo, uint8_t ReportID,
void* ReportData, uint16_t ReportSize);
#endif
|