From 7c5444b89a49df7cb671b0b041567990d2a3012e Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Tue, 2 Jun 2009 10:54:32 +0000 Subject: 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. --- Demos/Device/GenericHID/GenericHID.c | 13 ++++++++++--- Demos/Device/GenericHID/GenericHID.h | 1 - 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'Demos/Device/GenericHID') diff --git a/Demos/Device/GenericHID/GenericHID.c b/Demos/Device/GenericHID/GenericHID.c index 4dfb8e455..9c8023a5c 100644 --- a/Demos/Device/GenericHID/GenericHID.c +++ b/Demos/Device/GenericHID/GenericHID.c @@ -40,7 +40,7 @@ USB_ClassInfo_HID_t Generic_HID_Interface = .ReportOUTEndpointNumber = GENERIC_OUT_EPNUM, .ReportOUTEndpointSize = GENERIC_EPSIZE, - .ReportBufferSize = GENERIC_REPORT_SIZE, + .ReportINBufferSize = GENERIC_REPORT_SIZE, .UsingReportProtocol = true, }; @@ -70,6 +70,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); } void EVENT_USB_Connect(void) @@ -95,9 +101,10 @@ void EVENT_USB_UnhandledControlPacket(void) USB_HID_ProcessControlPacket(&Generic_HID_Interface); } -void EVENT_USB_StartOfFrame(void) +ISR(TIMER0_COMPA_vect, ISR_BLOCK) { - USB_HID_RegisterStartOfFrame(&Generic_HID_Interface); + if (Generic_HID_Interface.IdleMSRemaining) + Generic_HID_Interface.IdleMSRemaining--; } uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData) diff --git a/Demos/Device/GenericHID/GenericHID.h b/Demos/Device/GenericHID/GenericHID.h index 27426431c..94a09af93 100644 --- a/Demos/Device/GenericHID/GenericHID.h +++ b/Demos/Device/GenericHID/GenericHID.h @@ -64,7 +64,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, -- cgit v1.2.3