diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2009-06-02 10:54:32 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2009-06-02 10:54:32 +0000 |
commit | 7c5444b89a49df7cb671b0b041567990d2a3012e (patch) | |
tree | 481a5b56d9f360773112b00761aa430d8121d976 /Demos/Device/KeyboardMouse | |
parent | 74b7c07e96562158de294f92baed4c83b4fce970 (diff) | |
download | lufa-7c5444b89a49df7cb671b0b041567990d2a3012e.tar.gz lufa-7c5444b89a49df7cb671b0b041567990d2a3012e.tar.bz2 lufa-7c5444b89a49df7cb671b0b041567990d2a3012e.zip |
Removed new Start of Frame event from the library; performance suffered far too much and it was only useful in one of the standard classes (HID). Altered HID demos to use the previous method of tracking millisecond periods via a hardware timer rather than the SOF events.
Fixed MIDI class driver blocking on unread events to the host.
Diffstat (limited to 'Demos/Device/KeyboardMouse')
-rw-r--r-- | Demos/Device/KeyboardMouse/KeyboardMouse.c | 21 | ||||
-rw-r--r-- | Demos/Device/KeyboardMouse/KeyboardMouse.h | 1 |
2 files changed, 15 insertions, 7 deletions
diff --git a/Demos/Device/KeyboardMouse/KeyboardMouse.c b/Demos/Device/KeyboardMouse/KeyboardMouse.c index 8f6a573a6..71a8375aa 100644 --- a/Demos/Device/KeyboardMouse/KeyboardMouse.c +++ b/Demos/Device/KeyboardMouse/KeyboardMouse.c @@ -41,7 +41,7 @@ USB_ClassInfo_HID_t Keyboard_HID_Interface = .ReportOUTEndpointNumber = KEYBOARD_OUT_EPNUM,
.ReportOUTEndpointSize = HID_EPSIZE,
- .ReportBufferSize = sizeof(USB_KeyboardReport_Data_t),
+ .ReportINBufferSize = sizeof(USB_KeyboardReport_Data_t),
.IdleCount = 500,
};
@@ -53,7 +53,7 @@ USB_ClassInfo_HID_t Mouse_HID_Interface = .ReportINEndpointNumber = MOUSE_IN_EPNUM,
.ReportINEndpointSize = HID_EPSIZE,
- .ReportBufferSize = sizeof(USB_MouseReport_Data_t),
+ .ReportINBufferSize = sizeof(USB_MouseReport_Data_t),
.ReportOUTEndpointNumber = 0,
.ReportOUTEndpointSize = 0,
@@ -85,7 +85,13 @@ void SetupHardware() /* Hardware Initialization */
Joystick_Init();
LEDs_Init();
- USB_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)
@@ -115,10 +121,13 @@ void EVENT_USB_UnhandledControlPacket(void) USB_HID_ProcessControlPacket(&Mouse_HID_Interface);
}
-void EVENT_USB_StartOfFrame(void)
+ISR(TIMER0_COMPA_vect, ISR_BLOCK)
{
- USB_HID_RegisterStartOfFrame(&Keyboard_HID_Interface);
- USB_HID_RegisterStartOfFrame(&Mouse_HID_Interface);
+ if (Keyboard_HID_Interface.IdleMSRemaining)
+ Keyboard_HID_Interface.IdleMSRemaining--;
+
+ if (Mouse_HID_Interface.IdleMSRemaining)
+ Mouse_HID_Interface.IdleMSRemaining--;
}
uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData)
diff --git a/Demos/Device/KeyboardMouse/KeyboardMouse.h b/Demos/Device/KeyboardMouse/KeyboardMouse.h index a5c3c5db2..c18c6e1af 100644 --- a/Demos/Device/KeyboardMouse/KeyboardMouse.h +++ b/Demos/Device/KeyboardMouse/KeyboardMouse.h @@ -82,7 +82,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,
|