X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/8f6b4ddf764c3a54e42d00a7502c82c5c3e71b1c..5acf23b25465b82e5516510ee45aa9ed15178ad5:/Projects/Magstripe/Magstripe.h diff --git a/Projects/Magstripe/Magstripe.h b/Projects/Magstripe/Magstripe.h index 0393c3603..aabf6ac91 100644 --- a/Projects/Magstripe/Magstripe.h +++ b/Projects/Magstripe/Magstripe.h @@ -40,45 +40,23 @@ /* Includes: */ #include #include - #include #include - #include - #include #include "Descriptors.h" - #include "MagstripeHW.h" - #include "CircularBitBuffer.h" + #include "Lib/MagstripeHW.h" + #include "Lib/CircularBitBuffer.h" - #include // Library Version Information - #include // USB Functionality - #include // Simple scheduler for task management - - - /* Task Definitions: */ - /** Task definition for the keyboard and magnetic card reading task. */ - TASK(USB_Keyboard_Report); - - TASK(Magstripe_Read); + #include + #include + #include /* Macros: */ - /** HID Class Specific Request to get the current HID report from the device. */ - #define REQ_GetReport 0x01 - - /** HID Class Specific Request to get the current device idle count. */ - #define REQ_GetIdle 0x02 - - /** HID Class Specific Request to set the current HID report to the device. */ - #define REQ_SetReport 0x09 - - /** HID Class Specific Request to set the device's idle count. */ - #define REQ_SetIdle 0x0A - - /** HID Class Specific Request to get the current HID report protocol mode. */ - #define REQ_GetProtocol 0x03 - - /** HID Class Specific Request to set the current HID report protocol mode. */ - #define REQ_SetProtocol 0x0B - + /** Total number of tracks which can be read from the card, between 1 and 3. */ + #define TOTAL_TRACKS 3 + + /** HID keyboard keycode to indicate that no is currently pressed. */ + #define KEY_NONE 0 + /** HID keyboard keycode to indicate that the "1" key is currently pressed. */ #define KEY_1 30 @@ -99,23 +77,18 @@ uint8_t Reserved; /**< Reserved for OEM use, always set to 0 */ uint8_t KeyCode; /**< Key code array for pressed keys - up to six can be given simultaneously */ } USB_KeyboardReport_Data_t; - - /* Event Handlers: */ - /** Indicates that this module will catch the USB_Connect event when thrown by the library. */ - HANDLES_EVENT(USB_Connect); - - /** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */ - HANDLES_EVENT(USB_Disconnect); - - /** Indicates that this module will catch the USB_ConfigurationChanged event when thrown by the library. */ - HANDLES_EVENT(USB_ConfigurationChanged); - - /** Indicates that this module will catch the USB_UnhandledControlPacket event when thrown by the library. */ - HANDLES_EVENT(USB_UnhandledControlPacket); - + /* Function Prototypes: */ - bool GetNextReport(USB_KeyboardReport_Data_t* ReportData); - void SendKey(USB_KeyboardReport_Data_t* KeyboardReportData, uint8_t Key); - void Send(USB_KeyboardReport_Data_t* KeyboardReportData, bool SendReport); + void SetupHardware(void); + void ReadMagstripeData(void); + 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); + void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID, + const void* ReportData, const uint16_t ReportSize); + #endif