aboutsummaryrefslogtreecommitdiff
path: root/Projects/Magstripe/Magstripe.c
diff options
context:
space:
mode:
authorDean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28>2009-06-02 10:54:32 +0000
committerDean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28>2009-06-02 10:54:32 +0000
commitf4dd6469e16fb73b895ef80b589464101970a974 (patch)
tree481a5b56d9f360773112b00761aa430d8121d976 /Projects/Magstripe/Magstripe.c
parent025014dc24ec91e09c8b9eee3fe06a2a6665cef8 (diff)
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. git-svn-id: http://lufa-lib.googlecode.com/svn/trunk@564 d5102386-fcda-11dd-9fdb-3debd5008f28
Diffstat (limited to 'Projects/Magstripe/Magstripe.c')
-rw-r--r--Projects/Magstripe/Magstripe.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/Projects/Magstripe/Magstripe.c b/Projects/Magstripe/Magstripe.c
index 5cd107e9..871db28c 100644
--- a/Projects/Magstripe/Magstripe.c
+++ b/Projects/Magstripe/Magstripe.c
@@ -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)