Kiibohd Controller
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.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

usb_desc.h 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #ifndef _usb_desc_h_
  2. #define _usb_desc_h_
  3. // This header is NOT meant to be included when compiling
  4. // user sketches in Arduino. The low-level functions
  5. // provided by usb_dev.c are meant to be called only by
  6. // code which provides higher-level interfaces to the user.
  7. #include <stdint.h>
  8. #include <stddef.h>
  9. #include "usb_com.h"
  10. #define ENDPOINT_UNUSED 0x00
  11. #define ENDPOINT_TRANSIMIT_ONLY 0x15
  12. #define ENDPOINT_RECEIVE_ONLY 0x19
  13. #define ENDPOINT_TRANSMIT_AND_RECEIVE 0x1D
  14. // Some operating systems, especially Windows, may cache USB device
  15. // info. Changes to the device name may not update on the same
  16. // computer unless the vendor or product ID numbers change, or the
  17. // "bcdDevice" revision code is increased.
  18. #define DEVICE_CLASS 0xEF
  19. #define DEVICE_SUBCLASS 0x02
  20. #define DEVICE_PROTOCOL 0x01
  21. #define EP0_SIZE 64
  22. #define NUM_ENDPOINTS 15
  23. #define NUM_INTERFACE 5
  24. #define CDC_IAD_DESCRIPTOR 1
  25. #define CDC_STATUS_INTERFACE 0
  26. #define CDC_DATA_INTERFACE 1 // Serial
  27. #define CDC_ACM_ENDPOINT 2
  28. #define CDC_RX_ENDPOINT 3
  29. #define CDC_TX_ENDPOINT 4
  30. #define CDC_ACM_SIZE 16
  31. #define CDC_RX_SIZE 64
  32. #define CDC_TX_SIZE 64
  33. #define KEYBOARD_INTERFACE 2 // Keyboard
  34. #define KEYBOARD_ENDPOINT 1
  35. #define KEYBOARD_SIZE 8
  36. #define KEYBOARD_INTERVAL 1
  37. #define MOUSE_INTERFACE 3 // Mouse
  38. #define MOUSE_ENDPOINT 5
  39. #define MOUSE_SIZE 8
  40. #define MOUSE_INTERVAL 2
  41. #define JOYSTICK_INTERFACE 4 // Joystick
  42. #define JOYSTICK_ENDPOINT 6
  43. #define JOYSTICK_SIZE 16
  44. #define JOYSTICK_INTERVAL 1
  45. #define KEYBOARD_DESC_OFFSET (9+8 + 9+5+5+4+5+7+9+7+7 + 9)
  46. #define MOUSE_DESC_OFFSET (9+8 + 9+5+5+4+5+7+9+7+7 + 9+9+7 + 9)
  47. #define JOYSTICK_DESC_OFFSET (9+8 + 9+5+5+4+5+7+9+7+7 + 9+9+7 + 9+9+7 + 9)
  48. #define CONFIG_DESC_SIZE (9+8 + 9+5+5+4+5+7+9+7+7 + 9+9+7 + 9+9+7 + 9+9+7)
  49. #define ENDPOINT1_CONFIG ENDPOINT_TRANSIMIT_ONLY
  50. #define ENDPOINT2_CONFIG ENDPOINT_TRANSIMIT_ONLY
  51. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_ONLY
  52. #define ENDPOINT4_CONFIG ENDPOINT_TRANSIMIT_ONLY
  53. #define ENDPOINT5_CONFIG ENDPOINT_TRANSIMIT_ONLY
  54. #define ENDPOINT6_CONFIG ENDPOINT_TRANSIMIT_ONLY
  55. // NUM_ENDPOINTS = number of non-zero endpoints (0 to 15)
  56. extern const uint8_t usb_endpoint_config_table[NUM_ENDPOINTS];
  57. typedef struct {
  58. uint16_t wValue;
  59. uint16_t wIndex;
  60. const uint8_t *addr;
  61. uint16_t length;
  62. } usb_descriptor_list_t;
  63. extern const usb_descriptor_list_t usb_descriptor_list[];
  64. #endif