usb_private.h 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 0x0488
  14. // These determine how much USB bandwidth is allocated (1=fastest)
  15. #define FLIGHTSIM_TX_INTERVAL 1
  16. #define FLIGHTSIM_RX_INTERVAL 1
  17. #define DEBUG_TX_INTERVAL 1
  18. #define DEBUG_RX_INTERVAL 2
  19. #define TRANSMIT_FLUSH_TIMEOUT 4 /* in milliseconds */
  20. #define TRANSMIT_TIMEOUT 25 /* in milliseconds */
  21. /**************************************************************************
  22. *
  23. * Endpoint Buffer Configuration
  24. *
  25. **************************************************************************/
  26. #define STR_PRODUCT L"Teensy Flight Sim Controls"
  27. #define ENDPOINT0_SIZE 64
  28. // Some operating systems, especially Windows, may cache USB device
  29. // info. Changes to the device name may not update on the same
  30. // computer unless the vendor or product ID numbers change, or the
  31. // "bcdDevice" revision code is increased.
  32. #define FLIGHTSIM_INTERFACE 0
  33. #define FLIGHTSIM_TX_ENDPOINT 3
  34. #define FLIGHTSIM_TX_BUFFER EP_DOUBLE_BUFFER
  35. #define FLIGHTSIM_TX_SIZE 64
  36. #define FLIGHTSIM_RX_ENDPOINT 4
  37. #define FLIGHTSIM_RX_BUFFER EP_DOUBLE_BUFFER
  38. #define FLIGHTSIM_RX_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_RX_ENDPOINT 2
  44. #define DEBUG_RX_SIZE 32
  45. #define DEBUG_RX_BUFFER EP_DOUBLE_BUFFER
  46. #define NUM_ENDPOINTS 5
  47. #define NUM_INTERFACE 2
  48. // setup
  49. void usb_init(void); // initialize everything
  50. void usb_shutdown(void); // shut off USB
  51. // variables
  52. extern volatile uint8_t usb_configuration;
  53. extern volatile uint8_t usb_suspended;
  54. extern volatile uint8_t debug_flush_timer;
  55. extern volatile uint16_t rawhid_rx_timeout_count;
  56. extern volatile uint16_t rawhid_tx_timeout_count;
  57. #ifdef __cplusplus
  58. } // extern "C"
  59. #endif
  60. #endif