Teensy 4.1 core updated for C++20
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

109 lines
2.7KB

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