X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/7f9f97c792dee6875fbca9806422bdd7d6c5a657..58a39c6666cd9b085e402d5edc49d58fb759a9a3:/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c?ds=inline diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c index 25b51b57b..683ab66f7 100644 --- a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c +++ b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c @@ -118,12 +118,6 @@ void SetupHardware(void) /* Clear Dataflash sector protections, if enabled */ DataflashManager_ResetDataflashProtections(); - - /* Millisecond timer initialization, with output compare interrupt enabled for the HID idle timing */ - OCR0A = ((F_CPU / 64) / 1000); - TCCR0A = (1 << WGM01); - TCCR0B = ((1 << CS01) | (1 << CS00)); - TIMSK0 = (1 << OCIE0A); } /** Event handler for the library USB Connection event. */ @@ -145,8 +139,11 @@ void EVENT_USB_Device_ConfigurationChanged(void) if (!(MS_Device_ConfigureEndpoints(&Disk_MS_Interface))) LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + if (!(HID_Device_ConfigureEndpoints(&Keyboard_HID_Interface))) LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + + USB_Device_EnableSOFEvents(); } /** Event handler for the library USB Unhandled Control Request event. */ @@ -171,10 +168,10 @@ bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* MSInterfa return CommandSuccess; } -/** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */ -ISR(TIMER0_COMPA_vect, ISR_BLOCK) +/** Event handler for the USB device Start Of Frame event. */ +void EVENT_USB_Device_StartOfFrame(void) { - HID_Device_MillisecondElapsed(&Keyboard_HID_Interface); + HID_Device_MillisecondElapsed(&Keyboard_HID_Interface); } /** HID class driver callback function for the creation of HID reports to the host.