3      Copyright (C) Dean Camera, 2009. 
   5   dean [at] fourwalledcubicle [dot] com 
   6       www.fourwalledcubicle.com 
  10   Copyright 2009  Denver Gingerich (denver [at] ossguy [dot] com) 
  11   Copyright 2009  Dean Camera (dean [at] fourwalledcubicle [dot] com) 
  13   Permission to use, copy, modify, and distribute this software 
  14   and its documentation for any purpose and without fee is hereby 
  15   granted, provided that the above copyright notice appear in all 
  16   copies and that both that the copyright notice and this 
  17   permission notice and warranty disclaimer appear in supporting 
  18   documentation, and that the name of the author not be used in 
  19   advertising or publicity pertaining to distribution of the 
  20   software without specific, written prior permission. 
  22   The author disclaim all warranties with regard to this 
  23   software, including all implied warranties of merchantability 
  24   and fitness.  In no event shall the author be liable for any 
  25   special, indirect or consequential damages or any damages 
  26   whatsoever resulting from loss of use, data or profits, whether 
  27   in an action of contract, negligence or other tortious action, 
  28   arising out of or in connection with the use or performance of 
  34  *  Header file for Magstripe.c. 
  43                 #include <avr/interrupt.h> 
  44                 #include <avr/power.h> 
  48                 #include "Descriptors.h" 
  49                 #include "MagstripeHW.h" 
  50                 #include "CircularBitBuffer.h" 
  52                 #include <LUFA/Version.h>                    // Library Version Information 
  53                 #include <LUFA/Common/ButtLoadTag.h>         // PROGMEM tags readable by the ButtLoad project 
  54                 #include <LUFA/Drivers/USB/USB.h>            // USB Functionality 
  55                 #include <LUFA/Scheduler/Scheduler.h>        // Simple scheduler for task management 
  58         /* Task Definitions: */ 
  59                 /** Task definition for the keyboard and magnetic card reading task. */ 
  60                 TASK(USB_Keyboard_Report
); 
  65                 /** HID Class Specific Request to get the current HID report from the device. */ 
  66                 #define REQ_GetReport      0x01 
  68                 /** HID Class Specific Request to get the current device idle count. */ 
  69                 #define REQ_GetIdle        0x02 
  71                 /** HID Class Specific Request to set the current HID report to the device. */ 
  72                 #define REQ_SetReport      0x09 
  74                 /** HID Class Specific Request to set the device's idle count. */ 
  75                 #define REQ_SetIdle        0x0A 
  77                 /** HID Class Specific Request to get the current HID report protocol mode. */ 
  78                 #define REQ_GetProtocol    0x03 
  80                 /** HID Class Specific Request to set the current HID report protocol mode. */ 
  81                 #define REQ_SetProtocol    0x0B 
  83                 /** HID keyboard keycode to indicate that the "1" key is currently pressed. */ 
  86                 /** HID keyboard keycode to indicate that the "0" key is currently pressed. */ 
  89                 /** HID keyboard keycode to indicate that the enter key is currently pressed. */ 
  93                 /** Type define for the keyboard report structure. This structure matches the report layout 
  94                  *  given to the host in the HID Report descriptor, as well as matches the boot protocol report 
  95                  *  structure. This means that this one report structure can be used in both Report and Boot Protocol 
  99                         uint8_t Modifier
; /**< Modifier byte, indicating pressed modifier keys such as CTRL or ALT */ 
 100                         uint8_t Reserved
; /**< Reserved for OEM use, always set to 0 */ 
 101                         uint8_t KeyCode
; /**< Key code array for pressed keys - up to six can be given simultaneously */ 
 102                 } USB_KeyboardReport_Data_t
; 
 104         /* Event Handlers: */ 
 105                 /** Indicates that this module will catch the USB_Connect event when thrown by the library. */ 
 106                 HANDLES_EVENT(USB_Connect
); 
 108                 /** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */ 
 109                 HANDLES_EVENT(USB_Disconnect
); 
 111                 /** Indicates that this module will catch the USB_ConfigurationChanged event when thrown by the library. */ 
 112                 HANDLES_EVENT(USB_ConfigurationChanged
); 
 114                 /** Indicates that this module will catch the USB_UnhandledControlPacket event when thrown by the library. */ 
 115                 HANDLES_EVENT(USB_UnhandledControlPacket
); 
 117         /* Function Prototypes: */ 
 118                 bool GetNextReport(USB_KeyboardReport_Data_t
* ReportData
); 
 119                 void SendKey(USB_KeyboardReport_Data_t
* KeyboardReportData
, uint8_t Key
); 
 120                 void Send(USB_KeyboardReport_Data_t
* KeyboardReportData
, bool SendReport
);