Teensy 4.1 core updated for C++20
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.

usb_private.h 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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 0x0482
  14. #define TRANSMIT_FLUSH_TIMEOUT 4 /* in milliseconds */
  15. #define TRANSMIT_TIMEOUT 25 /* in milliseconds */
  16. /**************************************************************************
  17. *
  18. * Endpoint Buffer Configuration
  19. *
  20. **************************************************************************/
  21. // 0: control 64
  22. // 1: debug IN 64x2
  23. // 2: debug OUT 32x2
  24. // 3: keyboard IN 8x2
  25. // 4: mouse IN 16x2
  26. // 5: joystick IN 16x2
  27. // 6: keyboard media IN 8x2
  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 STR_PRODUCT L"Teensy Keyboard/Mouse/Joystick"
  33. #define ENDPOINT0_SIZE 64
  34. #define DEBUG_INTERFACE 2
  35. #define DEBUG_TX_ENDPOINT 1
  36. #define DEBUG_TX_SIZE 64
  37. #define DEBUG_TX_BUFFER EP_DOUBLE_BUFFER
  38. #define DEBUG_TX_INTERVAL 1
  39. #define DEBUG_RX_ENDPOINT 2
  40. #define DEBUG_RX_SIZE 32
  41. #define DEBUG_RX_BUFFER EP_DOUBLE_BUFFER
  42. #define DEBUG_RX_INTERVAL 2
  43. #define KEYBOARD_INTERFACE 0
  44. #define KEYBOARD_ENDPOINT 3
  45. #define KEYBOARD_SIZE 8
  46. #define KEYBOARD_BUFFER EP_DOUBLE_BUFFER
  47. #define KEYBOARD_INTERVAL 1
  48. #define MOUSE_INTERFACE 1
  49. #define MOUSE_ENDPOINT 4
  50. #define MOUSE_SIZE 8
  51. #define MOUSE_BUFFER EP_DOUBLE_BUFFER
  52. #define MOUSE_INTERVAL 1
  53. #define JOYSTICK_INTERFACE 3
  54. #define JOYSTICK_ENDPOINT 5
  55. #define JOYSTICK_SIZE 16
  56. #define JOYSTICK_BUFFER EP_DOUBLE_BUFFER
  57. #define JOYSTICK_INTERVAL 2
  58. #define KEYMEDIA_INTERFACE 4
  59. #define KEYMEDIA_ENDPOINT 6
  60. #define KEYMEDIA_SIZE 8
  61. #define KEYMEDIA_BUFFER EP_DOUBLE_BUFFER
  62. #define KEYMEDIA_INTERVAL 4
  63. #define NUM_ENDPOINTS 7
  64. #define NUM_INTERFACE 5
  65. // setup
  66. void usb_init(void); // initialize everything
  67. void usb_shutdown(void); // shut off USB
  68. // variables
  69. extern volatile uint8_t usb_configuration;
  70. extern volatile uint8_t usb_suspended;
  71. extern volatile uint8_t debug_flush_timer;
  72. extern uint8_t keyboard_report_data[];
  73. extern uint8_t keyboard_idle_count;
  74. extern volatile uint8_t keyboard_leds;
  75. extern uint8_t mouse_buttons;
  76. extern uint8_t joystick_report_data[12];
  77. extern uint8_t keymedia_report_data[8];
  78. extern uint16_t keymedia_consumer_keys[4];
  79. extern uint8_t keymedia_system_keys[3];
  80. #ifdef __cplusplus
  81. } // extern "C"
  82. #endif
  83. #endif