aboutsummaryrefslogtreecommitdiffstats
path: root/Projects
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2009-08-16 08:51:54 +0000
committerDean Camera <dean@fourwalledcubicle.com>2009-08-16 08:51:54 +0000
commitb71ff7c8cd68209a74c8690f4d190cc634ef8fb3 (patch)
tree00dc93dadd1e8fc9841fec230be8dd7db006b6ba /Projects
parent25ddbb9e3bcf184ebf1c17ea254b3c0c924327e2 (diff)
downloadlufa-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')
-rw-r--r--Projects/Magstripe/Magstripe.c12
-rw-r--r--Projects/Magstripe/Magstripe.h1
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);
7 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413