diff options
Diffstat (limited to 'Demos/Device/Keyboard')
-rw-r--r-- | Demos/Device/Keyboard/Keyboard.c | 13 | ||||
-rw-r--r-- | Demos/Device/Keyboard/Keyboard.h | 1 |
2 files changed, 10 insertions, 4 deletions
diff --git a/Demos/Device/Keyboard/Keyboard.c b/Demos/Device/Keyboard/Keyboard.c index d8893bfaa..d506657a6 100644 --- a/Demos/Device/Keyboard/Keyboard.c +++ b/Demos/Device/Keyboard/Keyboard.c @@ -41,7 +41,7 @@ USB_ClassInfo_HID_t Keyboard_HID_Interface = .ReportOUTEndpointNumber = KEYBOARD_LEDS_EPNUM,
.ReportOUTEndpointSize = KEYBOARD_EPSIZE,
- .ReportBufferSize = sizeof(USB_KeyboardReport_Data_t),
+ .ReportINBufferSize = sizeof(USB_KeyboardReport_Data_t),
.IdleCount = 500,
};
@@ -73,6 +73,12 @@ void SetupHardware() LEDs_Init();
Buttons_Init();
USB_Init();
+
+ /* Millisecond timer initialization, with output compare interrupt enabled for the idle timing */
+ OCR0A = ((F_CPU / 64) / 1000);
+ TCCR0A = (1 << WGM01);
+ TCCR0B = ((1 << CS01) | (1 << CS00));
+ TIMSK0 = (1 << OCIE0A);
}
void EVENT_USB_Connect(void)
@@ -98,9 +104,10 @@ void EVENT_USB_UnhandledControlPacket(void) USB_HID_ProcessControlPacket(&Keyboard_HID_Interface);
}
-void EVENT_USB_StartOfFrame(void)
+ISR(TIMER0_COMPA_vect, ISR_BLOCK)
{
- USB_HID_RegisterStartOfFrame(&Keyboard_HID_Interface);
+ if (Keyboard_HID_Interface.IdleMSRemaining)
+ Keyboard_HID_Interface.IdleMSRemaining--;
}
uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData)
diff --git a/Demos/Device/Keyboard/Keyboard.h b/Demos/Device/Keyboard/Keyboard.h index eeb7be9b7..9cfc9aba4 100644 --- a/Demos/Device/Keyboard/Keyboard.h +++ b/Demos/Device/Keyboard/Keyboard.h @@ -78,7 +78,6 @@ void EVENT_USB_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void);
- void EVENT_USB_StartOfFrame(void);
uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData);
void CALLBACK_USB_HID_ProcessReceivedHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo,
|