aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Device/Joystick/Joystick.c
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2009-06-02 10:54:32 +0000
committerDean Camera <dean@fourwalledcubicle.com>2009-06-02 10:54:32 +0000
commit7c5444b89a49df7cb671b0b041567990d2a3012e (patch)
tree481a5b56d9f360773112b00761aa430d8121d976 /Demos/Device/Joystick/Joystick.c
parent74b7c07e96562158de294f92baed4c83b4fce970 (diff)
downloadlufa-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/Joystick/Joystick.c')
-rw-r--r--Demos/Device/Joystick/Joystick.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/Demos/Device/Joystick/Joystick.c b/Demos/Device/Joystick/Joystick.c
index e073a87fd..d5c20737d 100644
--- a/Demos/Device/Joystick/Joystick.c
+++ b/Demos/Device/Joystick/Joystick.c
@@ -37,7 +37,7 @@ USB_ClassInfo_HID_t Joystick_HID_Interface =
.ReportINEndpointNumber = JOYSTICK_EPNUM,
.ReportINEndpointSize = JOYSTICK_EPSIZE,
- .ReportBufferSize = sizeof(USB_JoystickReport_Data_t),
+ .ReportINBufferSize = sizeof(USB_JoystickReport_Data_t),
.UsingReportProtocol = true,
};
@@ -69,6 +69,12 @@ void SetupHardware(void)
LEDs_Init();
Buttons_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)
@@ -94,9 +100,10 @@ void EVENT_USB_UnhandledControlPacket(void)
USB_HID_ProcessControlPacket(&Joystick_HID_Interface);
}
-void EVENT_USB_StartOfFrame(void)
+ISR(TIMER0_COMPA_vect, ISR_BLOCK)
{
- USB_HID_RegisterStartOfFrame(&Joystick_HID_Interface);
+ if (Joystick_HID_Interface.IdleMSRemaining)
+ Joystick_HID_Interface.IdleMSRemaining--;
}
uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData)