diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2009-08-16 08:51:54 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2009-08-16 08:51:54 +0000 |
commit | b71ff7c8cd68209a74c8690f4d190cc634ef8fb3 (patch) | |
tree | 00dc93dadd1e8fc9841fec230be8dd7db006b6ba /Projects/Magstripe | |
parent | 25ddbb9e3bcf184ebf1c17ea254b3c0c924327e2 (diff) | |
download | lufa-b71ff7c8cd68209a74c8690f4d190cc634ef8fb3.tar.gz lufa-b71ff7c8cd68209a74c8690f4d190cc634ef8fb3.tar.bz2 lufa-b71ff7c8cd68209a74c8690f4d190cc634ef8fb3.zip |
Added new EVENT_USB_Device_StartOfFrame() event, controlled by the new USB_Device_EnableSOFEvents() and USB_Device_DisableSOFEvents() macros to give bus-synchronised millisecond interrupts when in USB device mode.
Diffstat (limited to 'Projects/Magstripe')
-rw-r--r-- | Projects/Magstripe/Magstripe.c | 12 | ||||
-rw-r--r-- | Projects/Magstripe/Magstripe.h | 1 |
2 files changed, 5 insertions, 8 deletions
diff --git a/Projects/Magstripe/Magstripe.c b/Projects/Magstripe/Magstripe.c index 5be34492a..3ea505296 100644 --- a/Projects/Magstripe/Magstripe.c +++ b/Projects/Magstripe/Magstripe.c @@ -99,12 +99,6 @@ 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);
}
/** Determines if a card has been inserted, and if so reads in each track's contents into the bit buffers
@@ -148,6 +142,8 @@ void ReadMagstripeData(void) void EVENT_USB_Device_ConfigurationChanged(void)
{
HID_Device_ConfigureEndpoints(&Keyboard_HID_Interface);
+
+ USB_Device_EnableSOFEvents();
}
/** Event handler for the library USB Unhandled Control Packet event. */
@@ -156,8 +152,8 @@ void EVENT_USB_Device_UnhandledControlRequest(void) HID_Device_ProcessControlRequest(&Keyboard_HID_Interface);
}
-/** Timer 0 CTC ISR, firing once each millisecond to keep track of elapsed idle time in the HID interface. */
-ISR(TIMER0_COMPA_vect, ISR_BLOCK)
+/** Event handler for the USB device Start Of Frame event. */
+void EVENT_USB_Device_StartOfFrame(void)
{
HID_Device_MillisecondElapsed(&Keyboard_HID_Interface);
}
diff --git a/Projects/Magstripe/Magstripe.h b/Projects/Magstripe/Magstripe.h index 7cbda8302..aabf6ac91 100644 --- a/Projects/Magstripe/Magstripe.h +++ b/Projects/Magstripe/Magstripe.h @@ -84,6 +84,7 @@ void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void);
+ void EVENT_USB_Device_StartOfFrame(void);
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
void* ReportData, uint16_t* ReportSize);
|