aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Device/ClassDriver/GenericHID/GenericHID.c
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2009-08-16 08:51:54 +0000
committerDean Camera <dean@fourwalledcubicle.com>2009-08-16 08:51:54 +0000
commitb71ff7c8cd68209a74c8690f4d190cc634ef8fb3 (patch)
tree00dc93dadd1e8fc9841fec230be8dd7db006b6ba /Demos/Device/ClassDriver/GenericHID/GenericHID.c
parent25ddbb9e3bcf184ebf1c17ea254b3c0c924327e2 (diff)
downloadlufa-b71ff7c8cd68209a74c8690f4d190cc634ef8fb3.tar.gz
lufa-b71ff7c8cd68209a74c8690f4d190cc634ef8fb3.tar.bz2
lufa-b71ff7c8cd68209a74c8690f4d190cc634ef8fb3.zip
Added new EVENT_USB_Device_StartOfFrame() event, controlled by the new USB_Device_EnableSOFEvents() and USB_Device_DisableSOFEvents() macros to give bus-synchronised millisecond interrupts when in USB device mode.
Diffstat (limited to 'Demos/Device/ClassDriver/GenericHID/GenericHID.c')
-rw-r--r--Demos/Device/ClassDriver/GenericHID/GenericHID.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/Demos/Device/ClassDriver/GenericHID/GenericHID.c b/Demos/Device/ClassDriver/GenericHID/GenericHID.c
index 13db6bf74..c27558b9e 100644
--- a/Demos/Device/ClassDriver/GenericHID/GenericHID.c
+++ b/Demos/Device/ClassDriver/GenericHID/GenericHID.c
@@ -94,18 +94,12 @@ void SetupHardware(void)
/* Hardware Initialization */
LEDs_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);
}
/** Event handler for the library USB Connection event. */
void EVENT_USB_Device_Connect(void)
{
- LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
+ LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
}
/** Event handler for the library USB Disconnection event. */
@@ -121,6 +115,8 @@ void EVENT_USB_Device_ConfigurationChanged(void)
if (!(HID_Device_ConfigureEndpoints(&Generic_HID_Interface)))
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
+
+ USB_Device_EnableSOFEvents();
}
/** Event handler for the library USB Unhandled Control Request event. */
@@ -129,8 +125,8 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
HID_Device_ProcessControlRequest(&Generic_HID_Interface);
}
-/** 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(&Generic_HID_Interface);
}