您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

usb_private.h 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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 0x0486
  14. #define RAWHID_USAGE_PAGE 0xFFAB // recommended: 0xFF00 to 0xFFFF
  15. #define RAWHID_USAGE 0x0200 // recommended: 0x0100 to 0xFFFF
  16. // These determine how much USB bandwidth is allocated (1=fastest)
  17. #define RAWHID_TX_INTERVAL 1
  18. #define RAWHID_RX_INTERVAL 1
  19. #define DEBUG_TX_INTERVAL 1
  20. #define DEBUG_RX_INTERVAL 2
  21. #define TRANSMIT_FLUSH_TIMEOUT 4 /* in milliseconds */
  22. #define TRANSMIT_TIMEOUT 25 /* in milliseconds */
  23. /**************************************************************************
  24. *
  25. * Endpoint Buffer Configuration
  26. *
  27. **************************************************************************/
  28. #define STR_PRODUCT L"Teensyduino RawHID Device"
  29. #define STR_RAWHID L"Teensyduino RawHID"
  30. #define STR_DEBUG L"Emulated Arduino Serial"
  31. #define ENDPOINT0_SIZE 64
  32. // Some operating systems, especially Windows, may cache USB device
  33. // info. Changes to the device name may not update on the same
  34. // computer unless the vendor or product ID numbers change, or the
  35. // "bcdDevice" revision code is increased.
  36. #define RAWHID_INTERFACE 0
  37. #define RAWHID_TX_ENDPOINT 3
  38. #define RAWHID_TX_BUFFER EP_DOUBLE_BUFFER
  39. #define RAWHID_TX_SIZE 64
  40. #define RAWHID_RX_ENDPOINT 4
  41. #define RAWHID_RX_BUFFER EP_DOUBLE_BUFFER
  42. #define RAWHID_RX_SIZE 64
  43. #define DEBUG_INTERFACE 1
  44. #define DEBUG_TX_ENDPOINT 1
  45. #define DEBUG_TX_SIZE 64
  46. #define DEBUG_TX_BUFFER EP_DOUBLE_BUFFER
  47. #define DEBUG_RX_ENDPOINT 2
  48. #define DEBUG_RX_SIZE 32
  49. #define DEBUG_RX_BUFFER EP_DOUBLE_BUFFER
  50. #define NUM_ENDPOINTS 5
  51. #define NUM_INTERFACE 2
  52. // setup
  53. void usb_init(void); // initialize everything
  54. void usb_shutdown(void); // shut off USB
  55. // variables
  56. extern volatile uint8_t usb_configuration;
  57. extern volatile uint8_t usb_suspended;
  58. extern volatile uint8_t debug_flush_timer;
  59. extern volatile uint16_t rawhid_rx_timeout_count;
  60. extern volatile uint16_t rawhid_tx_timeout_count;
  61. #ifdef __cplusplus
  62. } // extern "C"
  63. #endif
  64. #endif