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.

93 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. #ifndef STR_PRODUCT
  36. #define STR_PRODUCT L"Teensy MIDI"
  37. #endif
  38. #define ENDPOINT0_SIZE 64
  39. #define DEBUG_INTERFACE 1
  40. #define DEBUG_TX_ENDPOINT 1
  41. #define DEBUG_TX_SIZE 64
  42. #define DEBUG_TX_BUFFER EP_DOUBLE_BUFFER
  43. #define DEBUG_TX_INTERVAL 1
  44. #define DEBUG_RX_ENDPOINT 2
  45. #define DEBUG_RX_SIZE 32
  46. #define DEBUG_RX_BUFFER EP_DOUBLE_BUFFER
  47. #define DEBUG_RX_INTERVAL 2
  48. #define MIDI_INTERFACE 0
  49. #define MIDI_TX_ENDPOINT 3
  50. #define MIDI_TX_SIZE 64
  51. #define MIDI_TX_BUFFER EP_DOUBLE_BUFFER
  52. #define MIDI_RX_ENDPOINT 4
  53. #define MIDI_RX_SIZE 64
  54. #define MIDI_RX_BUFFER EP_DOUBLE_BUFFER
  55. #define NUM_ENDPOINTS 5
  56. #define NUM_INTERFACE 2
  57. #endif
  58. // setup
  59. void usb_init(void); // initialize everything
  60. void usb_shutdown(void); // shut off USB
  61. // variables
  62. extern volatile uint8_t usb_configuration;
  63. extern volatile uint8_t usb_suspended;
  64. extern volatile uint8_t debug_flush_timer;
  65. #ifdef __cplusplus
  66. } // extern "C"
  67. #endif
  68. #endif