aboutsummaryrefslogtreecommitdiff
path: root/Demos/Device/ClassDriver/KeyboardMouse
diff options
context:
space:
mode:
authorDean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28>2009-08-16 08:51:54 +0000
committerDean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28>2009-08-16 08:51:54 +0000
commite10c96d30e319db63d1fdf95265c7afe30bbdf03 (patch)
tree00dc93dadd1e8fc9841fec230be8dd7db006b6ba /Demos/Device/ClassDriver/KeyboardMouse
parent946bf6b87c56b487281d4bc399ea7a10651b75d2 (diff)
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.
git-svn-id: http://lufa-lib.googlecode.com/svn/trunk@740 d5102386-fcda-11dd-9fdb-3debd5008f28
Diffstat (limited to 'Demos/Device/ClassDriver/KeyboardMouse')
-rw-r--r--Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c12
-rw-r--r--Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h1
2 files changed, 5 insertions, 8 deletions
diff --git a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c
index e2199904..5ac5b8d8 100644
--- a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c
+++ b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c
@@ -112,12 +112,6 @@ void SetupHardware()
Joystick_Init();
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. */
@@ -142,6 +136,8 @@ void EVENT_USB_Device_ConfigurationChanged(void)
if (!(HID_Device_ConfigureEndpoints(&Mouse_HID_Interface)))
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
+
+ USB_Device_EnableSOFEvents();
}
/** Event handler for the library USB Unhandled Control Request event. */
@@ -151,8 +147,8 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
HID_Device_ProcessControlRequest(&Mouse_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(&Keyboard_HID_Interface);
HID_Device_MillisecondElapsed(&Mouse_HID_Interface);
diff --git a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h
index 29756415..1f47c3e4 100644
--- a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h
+++ b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h
@@ -89,6 +89,7 @@
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void);
+ void EVENT_USB_Device_StartOfFrame(void);
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
void* ReportData, uint16_t* ReportSize);