Magstripe.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. LUFA Library
  3. Copyright (C) Dean Camera, 2018.
  4. dean [at] fourwalledcubicle [dot] com
  5. www.lufa-lib.org
  6. */
  7. /*
  8. Copyright 2010 Denver Gingerich (denver [at] ossguy [dot] com)
  9. Copyright 2018 Dean Camera (dean [at] fourwalledcubicle [dot] com)
  10. Permission to use, copy, modify, distribute, and sell this
  11. software and its documentation for any purpose is hereby granted
  12. without fee, provided that the above copyright notice appear in
  13. all copies and that both that the copyright notice and this
  14. permission notice and warranty disclaimer appear in supporting
  15. documentation, and that the name of the author not be used in
  16. advertising or publicity pertaining to distribution of the
  17. software without specific, written prior permission.
  18. The author disclaims all warranties with regard to this
  19. software, including all implied warranties of merchantability
  20. and fitness. In no event shall the author be liable for any
  21. special, indirect or consequential damages or any damages
  22. whatsoever resulting from loss of use, data or profits, whether
  23. in an action of contract, negligence or other tortious action,
  24. arising out of or in connection with the use or performance of
  25. this software.
  26. */
  27. /** \file
  28. *
  29. * Header file for Magstripe.c.
  30. */
  31. #ifndef _MAGSTRIPE_H_
  32. #define _MAGSTRIPE_H_
  33. /* Includes: */
  34. #include <avr/io.h>
  35. #include <avr/wdt.h>
  36. #include <avr/power.h>
  37. #include <avr/interrupt.h>
  38. #include "Descriptors.h"
  39. #include "Lib/MagstripeHW.h"
  40. #include "Lib/CircularBitBuffer.h"
  41. #include "Config/AppConfig.h"
  42. #include <LUFA/Drivers/USB/USB.h>
  43. #include <LUFA/Platform/Platform.h>
  44. /* Macros: */
  45. /** Total number of tracks which can be read from the card, between 1 and 3. */
  46. #define TOTAL_TRACKS 3
  47. /** HID keyboard keycode to indicate that no is currently pressed. */
  48. #define KEY_NONE 0
  49. /** HID keyboard keycode to indicate that the "1" key is currently pressed. */
  50. #define KEY_1 30
  51. /** HID keyboard keycode to indicate that the "0" key is currently pressed. */
  52. #define KEY_0 39
  53. /** HID keyboard keycode to indicate that the enter key is currently pressed. */
  54. #define KEY_ENTER 40
  55. /* Function Prototypes: */
  56. void SetupHardware(void);
  57. void ReadMagstripeData(void);
  58. void EVENT_USB_Device_ConfigurationChanged(void);
  59. void EVENT_USB_Device_ControlRequest(void);
  60. void EVENT_USB_Device_StartOfFrame(void);
  61. bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
  62. uint8_t* const ReportID,
  63. const uint8_t ReportType,
  64. void* ReportData,
  65. uint16_t* const ReportSize);
  66. void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
  67. const uint8_t ReportID,
  68. const uint8_t ReportType,
  69. const void* ReportData,
  70. const uint16_t ReportSize);
  71. #endif