Teensy 4.1 core updated for C++20
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

90 Zeilen
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 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. #ifndef STR_PRODUCT
  29. #define STR_PRODUCT L"Teensyduino RawHID Device"
  30. #endif
  31. #ifndef STR_RAWHID
  32. #define STR_RAWHID L"Teensyduino RawHID"
  33. #endif
  34. #ifndef STR_DEBUG
  35. #define STR_DEBUG L"Emulated Arduino Serial"
  36. #endif
  37. #define ENDPOINT0_SIZE 64
  38. // Some operating systems, especially Windows, may cache USB device
  39. // info. Changes to the device name may not update on the same
  40. // computer unless the vendor or product ID numbers change, or the
  41. // "bcdDevice" revision code is increased.
  42. #define RAWHID_INTERFACE 0
  43. #define RAWHID_TX_ENDPOINT 3
  44. #define RAWHID_TX_BUFFER EP_DOUBLE_BUFFER
  45. #define RAWHID_TX_SIZE 64
  46. #define RAWHID_RX_ENDPOINT 4
  47. #define RAWHID_RX_BUFFER EP_DOUBLE_BUFFER
  48. #define RAWHID_RX_SIZE 64
  49. #define DEBUG_INTERFACE 1
  50. #define DEBUG_TX_ENDPOINT 1
  51. #define DEBUG_TX_SIZE 64
  52. #define DEBUG_TX_BUFFER EP_DOUBLE_BUFFER
  53. #define DEBUG_RX_ENDPOINT 2
  54. #define DEBUG_RX_SIZE 32
  55. #define DEBUG_RX_BUFFER EP_DOUBLE_BUFFER
  56. #define NUM_ENDPOINTS 5
  57. #define NUM_INTERFACE 2
  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. extern volatile uint16_t rawhid_rx_timeout_count;
  66. extern volatile uint16_t rawhid_tx_timeout_count;
  67. #ifdef __cplusplus
  68. } // extern "C"
  69. #endif
  70. #endif