]> git.gir.st - tmk_keyboard.git/blob - protocol/lufa/LUFA-git/Projects/Magstripe/Magstripe.h
Squashed 'tmk_core/' changes from caca2c0..dc0e46e
[tmk_keyboard.git] / protocol / lufa / LUFA-git / Projects / Magstripe / Magstripe.h
1 /*
2 LUFA Library
3 Copyright (C) Dean Camera, 2014.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.lufa-lib.org
7 */
8
9 /*
10 Copyright 2010 Denver Gingerich (denver [at] ossguy [dot] com)
11 Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com)
12
13 Permission to use, copy, modify, distribute, and sell this
14 software and its documentation for any purpose is hereby granted
15 without fee, provided that the above copyright notice appear in
16 all 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.
21
22 The author disclaims 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
29 this software.
30 */
31
32 /** \file
33 *
34 * Header file for Magstripe.c.
35 */
36
37 #ifndef _MAGSTRIPE_H_
38 #define _MAGSTRIPE_H_
39
40 /* Includes: */
41 #include <avr/io.h>
42 #include <avr/wdt.h>
43 #include <avr/power.h>
44 #include <avr/interrupt.h>
45
46 #include "Descriptors.h"
47 #include "Lib/MagstripeHW.h"
48 #include "Lib/CircularBitBuffer.h"
49 #include "Config/AppConfig.h"
50
51 #include <LUFA/Drivers/USB/USB.h>
52 #include <LUFA/Platform/Platform.h>
53
54 /* Macros: */
55 /** Total number of tracks which can be read from the card, between 1 and 3. */
56 #define TOTAL_TRACKS 3
57
58 /** HID keyboard keycode to indicate that no is currently pressed. */
59 #define KEY_NONE 0
60
61 /** HID keyboard keycode to indicate that the "1" key is currently pressed. */
62 #define KEY_1 30
63
64 /** HID keyboard keycode to indicate that the "0" key is currently pressed. */
65 #define KEY_0 39
66
67 /** HID keyboard keycode to indicate that the enter key is currently pressed. */
68 #define KEY_ENTER 40
69
70 /* Function Prototypes: */
71 void SetupHardware(void);
72 void ReadMagstripeData(void);
73
74 void EVENT_USB_Device_ConfigurationChanged(void);
75 void EVENT_USB_Device_ControlRequest(void);
76 void EVENT_USB_Device_StartOfFrame(void);
77
78 bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
79 uint8_t* const ReportID,
80 const uint8_t ReportType,
81 void* ReportData,
82 uint16_t* const ReportSize);
83 void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
84 const uint8_t ReportID,
85 const uint8_t ReportType,
86 const void* ReportData,
87 const uint16_t ReportSize);
88
89 #endif
90
Imprint / Impressum