Commit 7c5444b8 authored by Dean Camera's avatar Dean Camera
Browse files

Removed new Start of Frame event from the library; performance suffered far...

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.
parent 74b7c07e
......@@ -228,8 +228,6 @@ void USB_ResetInterface(void)
#if defined(USB_DEVICE_ONLY)
USB_INT_Enable(USB_INT_SUSPEND);
USB_INT_Enable(USB_INT_EORSTI);
USB_INT_Enable(USB_INT_SOFI);
#if defined(CONTROL_ONLY_DEVICE)
UENUM = ENDPOINT_CONTROLEP;
#endif
......@@ -245,13 +243,11 @@ void USB_ResetInterface(void)
USB_INT_Enable(USB_INT_SRPI);
USB_INT_Enable(USB_INT_BCERRI);
USB_INT_Enable(USB_INT_HSOFI);
#else
if (USB_CurrentMode == USB_MODE_DEVICE)
{
USB_INT_Enable(USB_INT_SUSPEND);
USB_INT_Enable(USB_INT_EORSTI);
USB_INT_Enable(USB_INT_SOFI);
#if defined(CONTROL_ONLY_DEVICE)
UENUM = ENDPOINT_CONTROLEP;
......@@ -269,7 +265,6 @@ void USB_ResetInterface(void)
USB_INT_Enable(USB_INT_SRPI);
USB_INT_Enable(USB_INT_BCERRI);
USB_INT_Enable(USB_INT_HSOFI);
}
#endif
}
......@@ -39,6 +39,8 @@ USB_ClassInfo_HID_t Keyboard_HID_Interface =
.ReportINEndpointNumber = KEYBOARD_EPNUM,
.ReportINEndpointSize = KEYBOARD_EPSIZE,
.ReportINBufferSize = sizeof(USB_KeyboardReport_Data_t),
};
int main(void)
......@@ -70,6 +72,12 @@ void SetupHardware(void)
/* Hardware Initialization */
Magstripe_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 ReadMagstripeData(void)
......@@ -113,9 +121,10 @@ void EVENT_USB_UnhandledControlPacket(void)
USB_HID_ProcessControlPacket(&Keyboard_HID_Interface);
}
void EVENT_USB_StartOfFrame(void)
ISR(TIMER0_COMPA_vect, ISR_BLOCK)
{
USB_HID_RegisterStartOfFrame(&Keyboard_HID_Interface);
if (Keyboard_HID_Interface.IdleMSRemaining)
Keyboard_HID_Interface.IdleMSRemaining--;
}
uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData)
......
......@@ -78,7 +78,6 @@
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,
......
......@@ -183,7 +183,7 @@ CSTANDARD = -std=gnu99
# Place -D or -U options here for C sources
CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)
CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_DEVICE_ONLY
CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DUSB_DEVICE_ONLY
CDEFS += -DFIXED_CONTROL_ENDPOINT_SIZE=8 -DUSE_SINGLE_DEVICE_CONFIGURATION
CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
CDEFS += -DMAG_T1_CLOCK="(1 << 0)"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment