Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

90 lines
2.3KB

  1. #ifndef usb_serial_h__
  2. #define usb_serial_h__
  3. #include <stdint.h>
  4. #ifdef __cplusplus
  5. extern "C"{
  6. #endif
  7. /**************************************************************************
  8. *
  9. * Configurable Options
  10. *
  11. **************************************************************************/
  12. #define VENDOR_ID 0x16C0
  13. #define PRODUCT_ID 0x0485
  14. #define TRANSMIT_FLUSH_TIMEOUT 4 /* in milliseconds */
  15. #define TRANSMIT_TIMEOUT 25 /* in milliseconds */
  16. /**************************************************************************
  17. *
  18. * Endpoint Buffer Configuration
  19. *
  20. **************************************************************************/
  21. // These buffer sizes are best for most applications, but perhaps if you
  22. // want more buffering on some endpoint at the expense of others, this
  23. // is where you can make such changes. The AT90USB162 has only 176 bytes
  24. // of DPRAM (USB buffers) and only endpoints 3 & 4 can double buffer.
  25. // 0: control
  26. // 1: debug IN
  27. // 2: debug OUT
  28. // 3: midi IN
  29. // 4: midi OUT
  30. #if defined(__AVR_ATmega32U4__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
  31. // Some operating systems, especially Windows, may cache USB device
  32. // info. Changes to the device name may not update on the same
  33. // computer unless the vendor or product ID numbers change, or the
  34. // "bcdDevice" revision code is increased.
  35. #define STR_PRODUCT L"Teensy MIDI"
  36. #define ENDPOINT0_SIZE 64
  37. #define DEBUG_INTERFACE 1
  38. #define DEBUG_TX_ENDPOINT 1
  39. #define DEBUG_TX_SIZE 64
  40. #define DEBUG_TX_BUFFER EP_DOUBLE_BUFFER
  41. #define DEBUG_TX_INTERVAL 1
  42. #define DEBUG_RX_ENDPOINT 2
  43. #define DEBUG_RX_SIZE 32
  44. #define DEBUG_RX_BUFFER EP_DOUBLE_BUFFER
  45. #define DEBUG_RX_INTERVAL 2
  46. #define MIDI_INTERFACE 0
  47. #define MIDI_TX_ENDPOINT 3
  48. #define MIDI_TX_SIZE 64
  49. #define MIDI_TX_BUFFER EP_DOUBLE_BUFFER
  50. #define MIDI_RX_ENDPOINT 4
  51. #define MIDI_RX_SIZE 64
  52. #define MIDI_RX_BUFFER EP_DOUBLE_BUFFER
  53. #define NUM_ENDPOINTS 5
  54. #define NUM_INTERFACE 2
  55. #endif
  56. // setup
  57. void usb_init(void); // initialize everything
  58. void usb_shutdown(void); // shut off USB
  59. // variables
  60. extern volatile uint8_t usb_configuration;
  61. extern volatile uint8_t usb_suspended;
  62. extern volatile uint8_t debug_flush_timer;
  63. #ifdef __cplusplus
  64. } // extern "C"
  65. #endif
  66. #endif