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 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /* Teensyduino Core Library
  2. * http://www.pjrc.com/teensy/
  3. * Copyright (c) 2013 PJRC.COM, LLC.
  4. *
  5. * Permission is hereby granted, free of charge, to any person obtaining
  6. * a copy of this software and associated documentation files (the
  7. * "Software"), to deal in the Software without restriction, including
  8. * without limitation the rights to use, copy, modify, merge, publish,
  9. * distribute, sublicense, and/or sell copies of the Software, and to
  10. * permit persons to whom the Software is furnished to do so, subject to
  11. * the following conditions:
  12. *
  13. * 1. The above copyright notice and this permission notice shall be
  14. * included in all copies or substantial portions of the Software.
  15. *
  16. * 2. If the Software is incorporated into a build system that allows
  17. * selection among a list of target devices, then similar target
  18. * devices manufactured by PJRC.COM must be included in the list of
  19. * target devices and selectable in the same manner.
  20. *
  21. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  22. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  23. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  24. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  25. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  26. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  27. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  28. * SOFTWARE.
  29. */
  30. #ifndef _usb_desc_h_
  31. #define _usb_desc_h_
  32. // This header is NOT meant to be included when compiling
  33. // user sketches in Arduino. The low-level functions
  34. // provided by usb_dev.c are meant to be called only by
  35. // code which provides higher-level interfaces to the user.
  36. #include <stdint.h>
  37. #include <stddef.h>
  38. #include "output_com.h"
  39. #define ENDPOINT_UNUSED 0x00
  40. #define ENDPOINT_TRANSIMIT_ONLY 0x15
  41. #define ENDPOINT_RECEIVE_ONLY 0x19
  42. #define ENDPOINT_TRANSMIT_AND_RECEIVE 0x1D
  43. // Some operating systems, especially Windows, may cache USB device
  44. // info. Changes to the device name may not update on the same
  45. // computer unless the vendor or product ID numbers change, or the
  46. // "bcdDevice" revision code is increased.
  47. #define DEVICE_CLASS 0xEF
  48. #define DEVICE_SUBCLASS 0x02
  49. #define DEVICE_PROTOCOL 0x01
  50. #define EP0_SIZE 64
  51. #define NUM_ENDPOINTS 15
  52. #define NUM_INTERFACE 4
  53. #define CDC_IAD_DESCRIPTOR 1
  54. #define CDC_STATUS_INTERFACE 0
  55. #define CDC_DATA_INTERFACE 1 // Serial
  56. #define CDC_ACM_ENDPOINT 2
  57. #define CDC_RX_ENDPOINT 3
  58. #define CDC_TX_ENDPOINT 4
  59. #define CDC_ACM_SIZE 16
  60. #define CDC_RX_SIZE 64
  61. #define CDC_TX_SIZE 64
  62. #define KEYBOARD_INTERFACE 2 // Keyboard
  63. #define KEYBOARD_ENDPOINT 1
  64. #define KEYBOARD_SIZE 8
  65. #define KEYBOARD_INTERVAL 1
  66. #define MOUSE_INTERFACE 3 // Mouse
  67. #define MOUSE_ENDPOINT 5
  68. #define MOUSE_SIZE 8
  69. #define MOUSE_INTERVAL 2
  70. #define KEYBOARD_DESC_OFFSET (9+8 + 9+5+5+4+5+7+9+7+7 + 9)
  71. #define MOUSE_DESC_OFFSET (9+8 + 9+5+5+4+5+7+9+7+7 + 9+9+7 + 9)
  72. #define CONFIG_DESC_SIZE (9+8 + 9+5+5+4+5+7+9+7+7 + 9+9+7 + 9+9+7)
  73. #define ENDPOINT1_CONFIG ENDPOINT_TRANSIMIT_ONLY
  74. #define ENDPOINT2_CONFIG ENDPOINT_TRANSIMIT_ONLY
  75. #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_ONLY
  76. #define ENDPOINT4_CONFIG ENDPOINT_TRANSIMIT_ONLY
  77. #define ENDPOINT5_CONFIG ENDPOINT_TRANSIMIT_ONLY
  78. // NUM_ENDPOINTS = number of non-zero endpoints (0 to 15)
  79. extern const uint8_t usb_endpoint_config_table[NUM_ENDPOINTS];
  80. typedef struct {
  81. uint16_t wValue;
  82. uint16_t wIndex;
  83. const uint8_t *addr;
  84. uint16_t length;
  85. } usb_descriptor_list_t;
  86. extern const usb_descriptor_list_t usb_descriptor_list[];
  87. #endif