Minor documentation page updates.
[pub/USBasp.git] / Projects / Magstripe / Magstripe.h
1 /*
2 LUFA Library
3 Copyright (C) Dean Camera, 2009.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.fourwalledcubicle.com
7 */
8
9 /*
10 Copyright 2009 Denver Gingerich (denver [at] ossguy [dot] com)
11 Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
12
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.
21
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
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
45 #include "Descriptors.h"
46 #include "Lib/MagstripeHW.h"
47 #include "Lib/CircularBitBuffer.h"
48
49 #include <LUFA/Version.h>
50 #include <LUFA/Drivers/USB/USB.h>
51 #include <LUFA/Drivers/USB/Class/Device/HID.h>
52
53 /* Macros: */
54 /** HID keyboard keycode to indicate that the "1" key is currently pressed. */
55 #define KEY_1 30
56
57 /** HID keyboard keycode to indicate that the "0" key is currently pressed. */
58 #define KEY_0 39
59
60 /** HID keyboard keycode to indicate that the enter key is currently pressed. */
61 #define KEY_ENTER 40
62
63 /* Type Defines: */
64 /** Type define for the keyboard report structure. This structure matches the report layout
65 * given to the host in the HID Report descriptor, as well as matches the boot protocol report
66 * structure. This means that this one report structure can be used in both Report and Boot Protocol
67 * modes. */
68 typedef struct
69 {
70 uint8_t Modifier; /**< Modifier byte, indicating pressed modifier keys such as CTRL or ALT */
71 uint8_t Reserved; /**< Reserved for OEM use, always set to 0 */
72 uint8_t KeyCode; /**< Key code array for pressed keys - up to six can be given simultaneously */
73 } USB_KeyboardReport_Data_t;
74
75 /* Function Prototypes: */
76 void SetupHardware(void);
77 void ReadMagstripeData(void);
78
79 void EVENT_USB_ConfigurationChanged(void);
80 void EVENT_USB_UnhandledControlPacket(void);
81
82 uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData);
83 void CALLBACK_USB_HID_ProcessReceivedHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo,
84 void* ReportData, uint16_t ReportSize);
85
86 #endif