1 /* Teensyduino Core Library
2 * http://www.pjrc.com/teensy/
3 * Copyright (c) 2013 PJRC.COM, LLC.
4 * Modified by Jacob Alexander (2013-2014)
6 * Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sublicense, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * 1. The above copyright notice and this permission notice shall be
15 * included in all copies or substantial portions of the Software.
17 * 2. If the Software is incorporated into a build system that allows
18 * selection among a list of target devices, then similar target
19 * devices manufactured by PJRC.COM must be included in the list of
20 * target devices and selectable in the same manner.
22 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
26 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
27 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
28 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35 // This header is NOT meant to be included when compiling
36 // user sketches in Arduino. The low-level functions
37 // provided by usb_dev.c are meant to be called only by
38 // code which provides higher-level interfaces to the user.
42 #include "output_com.h"
44 #define ENDPOINT_UNUSED 0x00
45 #define ENDPOINT_TRANSIMIT_ONLY 0x15
46 #define ENDPOINT_RECEIVE_ONLY 0x19
47 #define ENDPOINT_TRANSMIT_AND_RECEIVE 0x1D
50 To modify a USB Type to have different interfaces, start in this
51 file. Delete the XYZ_INTERFACE lines for any interfaces you
52 wish to remove, and copy them from another USB Type for any you
55 Give each interface a unique number, and edit NUM_INTERFACE to
56 reflect the number of interfaces.
58 Within each interface, make sure it uses a unique set of endpoints.
59 Edit NUM_ENDPOINTS to be at least the largest endpoint number used.
60 Then edit the ENDPOINT*_CONFIG lines so each endpoint is configured
61 the proper way (transmit, receive, or both).
63 The CONFIG_DESC_SIZE and any XYZ_DESC_OFFSET numbers must be
64 edited to the correct sizes. See usb_desc.c for the giant array
65 of bytes. Someday these may be done automatically..... (but how?)
67 If you are using existing interfaces, the code in each file should
68 automatically adapt to the changes you specify. If you need to
69 create a new type of interface, you'll need to write the code which
70 sends and receives packets, and presents an API to the user.
72 Finally, edit usb_inst.cpp, which creats instances of the C++
73 objects for each combination.
75 Some operating systems, especially Windows, may cache USB device
76 info. Changes to the device name may not update on the same
77 computer unless the vendor or product ID numbers change, or the
78 "bcdDevice" revision code is increased.
80 If these instructions are missing steps or could be improved, please
81 let me know? http://forum.pjrc.com/forums/4-Suggestions-amp-Bug-Reports
86 #define DEVICE_CLASS 0xEF
87 #define DEVICE_SUBCLASS 0x02
88 #define DEVICE_PROTOCOL 0x01
90 #define NUM_ENDPOINTS 6
91 #define NUM_USB_BUFFERS 30
92 #define NUM_INTERFACE 4
94 #define CDC_IAD_DESCRIPTOR 1
95 #define CDC_STATUS_INTERFACE 0
96 #define CDC_DATA_INTERFACE 1 // Serial
97 #define CDC_ACM_ENDPOINT 2
98 #define CDC_RX_ENDPOINT 3
99 #define CDC_TX_ENDPOINT 4
100 #define CDC_ACM_SIZE 16
101 #define CDC_RX_SIZE 64
102 #define CDC_TX_SIZE 64
104 #define KEYBOARD_INTERFACE 2 // Keyboard
105 #define KEYBOARD_ENDPOINT 1
106 #define KEYBOARD_SIZE 8
107 #define KEYBOARD_INTERVAL 1
109 #define MOUSE_INTERFACE 3 // Mouse
110 #define MOUSE_ENDPOINT 5
112 #define MOUSE_INTERVAL 2
114 #define JOYSTICK_INTERFACE 4 // Joystick
115 #define JOYSTICK_ENDPOINT 6
116 #define JOYSTICK_SIZE 16
117 #define JOYSTICK_INTERVAL 1
119 #define KEYBOARD_DESC_OFFSET (9+8 + 9+5+5+4+5+7+9+7+7 + 9)
120 #define MOUSE_DESC_OFFSET (9+8 + 9+5+5+4+5+7+9+7+7 + 9+9+7 + 9)
121 #define JOYSTICK_DESC_OFFSET (9+8 + 9+5+5+4+5+7+9+7+7 + 9+9+7 + 9+9+7 + 9)
122 #define CONFIG_DESC_SIZE (9+8 + 9+5+5+4+5+7+9+7+7 + 9+9+7 + 9+9+7 + 9+9+7)
124 #define ENDPOINT1_CONFIG ENDPOINT_TRANSIMIT_ONLY
125 #define ENDPOINT2_CONFIG ENDPOINT_TRANSIMIT_ONLY
126 #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_ONLY
127 #define ENDPOINT4_CONFIG ENDPOINT_TRANSIMIT_ONLY
128 #define ENDPOINT5_CONFIG ENDPOINT_TRANSIMIT_ONLY
129 #define ENDPOINT6_CONFIG ENDPOINT_TRANSIMIT_ONLY
132 // NUM_ENDPOINTS = number of non-zero endpoints (0 to 15)
133 extern const uint8_t usb_endpoint_config_table[NUM_ENDPOINTS];
140 } usb_descriptor_list_t;
142 extern const usb_descriptor_list_t usb_descriptor_list[];