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.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 4
  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 KEYBOARD_DESC_OFFSET (9+8 + 9+5+5+4+5+7+9+7+7 + 9)
  42. #define MOUSE_DESC_OFFSET (9+8 + 9+5+5+4+5+7+9+7+7 + 9+9+7 + 9)
  43. #define CONFIG_DESC_SIZE (9+8 + 9+5+5+4+5+7+9+7+7 + 9+9+7 + 9+9+7)
  44. #define ENDPOINT1_CONFIG ENDPOINT_TRANSIMIT_ONLY
  45. #define ENDPOINT2_CONFIG ENDPOINT_TRANSIMIT_ONLY
  46. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_ONLY
  47. #define ENDPOINT4_CONFIG ENDPOINT_TRANSIMIT_ONLY
  48. #define ENDPOINT5_CONFIG ENDPOINT_TRANSIMIT_ONLY
  49. // NUM_ENDPOINTS = number of non-zero endpoints (0 to 15)
  50. extern const uint8_t usb_endpoint_config_table[NUM_ENDPOINTS];
  51. typedef struct {
  52. uint16_t wValue;
  53. uint16_t wIndex;
  54. const uint8_t *addr;
  55. uint16_t length;
  56. } usb_descriptor_list_t;
  57. extern const usb_descriptor_list_t usb_descriptor_list[];
  58. #endif