aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Device/LowLevel/Mouse/Mouse.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/LowLevel/Mouse/Mouse.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/LowLevel/Mouse/Mouse.c')
-rw-r--r--Demos/Device/LowLevel/Mouse/Mouse.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/Demos/Device/LowLevel/Mouse/Mouse.c b/Demos/Device/LowLevel/Mouse/Mouse.c
index 48f04612b..aa95e9c0c 100644
--- a/Demos/Device/LowLevel/Mouse/Mouse.c
+++ b/Demos/Device/LowLevel/Mouse/Mouse.c
@@ -85,12 +85,6 @@ void SetupHardware(void)
LEDs_Init();
Buttons_Init();
USB_Init();
-
- /* Millisecond timer initialization, with output compare interrupt enabled for the idle timing */
- OCR0A = 0x7D;
- TCCR0A = (1 << WGM01);
- TCCR0B = ((1 << CS01) | (1 << CS00));
- TIMSK0 = (1 << OCIE0A);
}
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and
@@ -129,6 +123,8 @@ void EVENT_USB_Device_ConfigurationChanged(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
+
+ USB_Device_EnableSOFEvents();
}
/** Event handler for the USB_UnhandledControlRequest event. This is used to catch standard and class specific
@@ -218,10 +214,8 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
}
}
-/** ISR for the timer 0 compare vector. This ISR fires once each millisecond, and increments the
- * scheduler elapsed idle period counter when the host has set an idle period.
- */
-ISR(TIMER0_COMPA_vect, ISR_BLOCK)
+/** Event handler for the USB device Start Of Frame event. */
+void EVENT_USB_Device_StartOfFrame(void)
{
/* One millisecond has elapsed, decrement the idle time remaining counter if it has not already elapsed */
if (IdleMSRemaining)