You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
2.9 KiB

8 years ago
8 years ago
8 years ago
7 years ago
8 years ago
8 years ago
8 years ago
  1. /*
  2. * Copyright 2012 Jun Wako <wakojun@gmail.com>
  3. * This file is based on:
  4. * LUFA-120219/Demos/Device/Lowlevel/KeyboardMouse
  5. * LUFA-120219/Demos/Device/Lowlevel/GenericHID
  6. */
  7. /*
  8. LUFA Library
  9. Copyright (C) Dean Camera, 2012.
  10. dean [at] fourwalledcubicle [dot] com
  11. www.lufa-lib.org
  12. */
  13. /*
  14. Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
  15. Copyright 2010 Denver Gingerich (denver [at] ossguy [dot] com)
  16. Permission to use, copy, modify, distribute, and sell this
  17. software and its documentation for any purpose is hereby granted
  18. without fee, provided that the above copyright notice appear in
  19. all copies and that both that the copyright notice and this
  20. permission notice and warranty disclaimer appear in supporting
  21. documentation, and that the name of the author not be used in
  22. advertising or publicity pertaining to distribution of the
  23. software without specific, written prior permission.
  24. The author disclaim all warranties with regard to this
  25. software, including all implied warranties of merchantability
  26. and fitness. In no event shall the author be liable for any
  27. special, indirect or consequential damages or any damages
  28. whatsoever resulting from loss of use, data or profits, whether
  29. in an action of contract, negligence or other tortious action,
  30. arising out of or in connection with the use or performance of
  31. this software.
  32. */
  33. #ifndef _LUFA_H_
  34. #define _LUFA_H_
  35. #include <avr/io.h>
  36. #include <avr/wdt.h>
  37. #include <avr/power.h>
  38. #include <avr/interrupt.h>
  39. #include <stdbool.h>
  40. #include <string.h>
  41. #include <LUFA/Version.h>
  42. #include <LUFA/Drivers/USB/USB.h>
  43. #include "host.h"
  44. #ifdef MIDI_ENABLE
  45. #include "process_midi.h"
  46. #endif
  47. #ifdef __cplusplus
  48. extern "C" {
  49. #endif
  50. extern host_driver_t lufa_driver;
  51. #ifdef __cplusplus
  52. }
  53. #endif
  54. #ifdef __AVR_XMEGA__
  55. #define MCUSR RST_STATUS
  56. #define WDRF RST_WDRF_bp
  57. #endif
  58. /* extra report structure */
  59. typedef struct {
  60. uint8_t report_id;
  61. uint16_t usage;
  62. } __attribute__ ((packed)) report_extra_t;
  63. #ifdef MIDI_ENABLE
  64. void MIDI_Task(void);
  65. MidiDevice midi_device;
  66. #endif
  67. #ifdef API_ENABLE
  68. #include "api.h"
  69. #endif
  70. #ifdef API_SYSEX_ENABLE
  71. #include "api_sysex.h"
  72. // Allocate space for encoding overhead.
  73. //The header and terminator are not stored to save a few bytes of precious ram
  74. #define MIDI_SYSEX_BUFFER (API_SYSEX_MAX_SIZE + API_SYSEX_MAX_SIZE / 7 + (API_SYSEX_MAX_SIZE % 7 ? 1 : 0))
  75. #endif
  76. // #if LUFA_VERSION_INTEGER < 0x120730
  77. // /* old API 120219 */
  78. // #define ENDPOINT_CONFIG(epnum, eptype, epdir, epsize, epbank) Endpoint_ConfigureEndpoint(epnum, eptype, epdir, epsize, epbank)
  79. // #else
  80. /* new API >= 120730 */
  81. #define ENDPOINT_BANK_SINGLE 1
  82. #define ENDPOINT_BANK_DOUBLE 2
  83. #define ENDPOINT_CONFIG(epnum, eptype, epdir, epsize, epbank) Endpoint_ConfigureEndpoint((epdir) | (epnum) , eptype, epsize, epbank)
  84. // #endif
  85. #endif