Mercurial > louis > kiibohd-controller
annotate Output/pjrcUSB/arm/usb_desc.h @ 449:45feb80a2ad1
Major USB update, fixes most (if not all) known issues
USB - General
- Refactored descriptors
- Enabled/Disable USB endpoints
- Added debug flags for special features
- Code cleanup
- Interface count calculation based off of enabled endpoints
- Delayed wTotalLength calculation to simplify descriptor offsets
- Re-ordered endpoints and interfaces
- Added more debug output
- Added usbInitTime to show how long keyboard initialization took
(Useful when debugging bad init sequences)
- Added function for usb_resume() which takes care of the resume sequence
* Resume is now only called if packets are starting to timeout
USB - Special Options
- Added enableDeviceRestartOnUSBTimeout
* A last resort hammer for bad USB Chipsets/OSs, don't use if you can help it
* Disabled
- Added enableUSBResume
* Enables host resume wake-up signalling, required to wake a computer from sleep
* Enabled
- Added enableUSBLowPowerNegotiation
* Enables power negotiation hack
* Required to use firmware with an IPad and other hard-limit low-power USB hosts
* Hasn't been tested with the recent changes
* Disabled
- Added enableUSBSuspend
* Enables power down events on host USB bus suspend
* Enabled
USB - Keyboard
- Attempted to cleanup HID SET_REPORT
* Works much better
* Still has an issue under Linux which generates *a lot* of NAKs (initializes quickly regardless)
+ Not present on other keyboards
+ SETUP -> OUT -> IN : This sequence is the problem
+ Specifically during the OUT phase
- Enabled
USB - CDC Virtual Serial Port
- Code cleanup
- Added convenience struct USBCDCLineCoding for easier debugging
- Attempted to cleanup CDC_SET_LING_CODING
* Works much better
* Still has an issue under Linux which generates *a lot* of NAKs (initializes quickly regardless)
+ SETUP -> OUT -> IN : This sequence is the problem
+ Specifically during the OUT phase
+ Likely the same issues as HID SET_REPORT
- Enabled
USB - Mouse
- Enabled
USB - Joystick
- Disabled
USB - RawIO
- Initial code, API not used yet
- Disabled
DFU
- Updated load script, now faster
author | Jacob Alexander <haata@kiibohd.com> |
---|---|
date | Tue, 31 May 2016 00:19:45 -0700 |
parents | 23a1868b4ac2 |
children |
rev | line source |
---|---|
117
5ffefdf89b37
Adding in USB module updates from Teensyduino 1.18rc2.
Jacob Alexander <haata@kiibohd.com>
parents:
105
diff
changeset
|
1 /* Teensyduino Core Library |
5ffefdf89b37
Adding in USB module updates from Teensyduino 1.18rc2.
Jacob Alexander <haata@kiibohd.com>
parents:
105
diff
changeset
|
2 * http://www.pjrc.com/teensy/ |
5ffefdf89b37
Adding in USB module updates from Teensyduino 1.18rc2.
Jacob Alexander <haata@kiibohd.com>
parents:
105
diff
changeset
|
3 * Copyright (c) 2013 PJRC.COM, LLC. |
420
23a1868b4ac2
Adding dynamic USB power support
Jacob Alexander <haata@kiibohd.com>
parents:
376
diff
changeset
|
4 * Modified by Jacob Alexander (2013-2016) |
117
5ffefdf89b37
Adding in USB module updates from Teensyduino 1.18rc2.
Jacob Alexander <haata@kiibohd.com>
parents:
105
diff
changeset
|
5 * |
5ffefdf89b37
Adding in USB module updates from Teensyduino 1.18rc2.
Jacob Alexander <haata@kiibohd.com>
parents:
105
diff
changeset
|
6 * Permission is hereby granted, free of charge, to any person obtaining |
5ffefdf89b37
Adding in USB module updates from Teensyduino 1.18rc2.
Jacob Alexander <haata@kiibohd.com>
parents:
105
diff
changeset
|
7 * a copy of this software and associated documentation files (the |
5ffefdf89b37
Adding in USB module updates from Teensyduino 1.18rc2.
Jacob Alexander <haata@kiibohd.com>
parents:
105
diff
changeset
|
8 * "Software"), to deal in the Software without restriction, including |
5ffefdf89b37
Adding in USB module updates from Teensyduino 1.18rc2.
Jacob Alexander <haata@kiibohd.com>
parents:
105
diff
changeset
|
9 * without limitation the rights to use, copy, modify, merge, publish, |
5ffefdf89b37
Adding in USB module updates from Teensyduino 1.18rc2.
Jacob Alexander <haata@kiibohd.com>
parents:
105
diff
changeset
|
10 * distribute, sublicense, and/or sell copies of the Software, and to |
5ffefdf89b37
Adding in USB module updates from Teensyduino 1.18rc2.
Jacob Alexander <haata@kiibohd.com>
parents:
105
diff
changeset
|
11 * permit persons to whom the Software is furnished to do so, subject to |
5ffefdf89b37
Adding in USB module updates from Teensyduino 1.18rc2.
Jacob Alexander <haata@kiibohd.com>
parents:
105
diff
changeset
|
12 * the following conditions: |
5ffefdf89b37
Adding in USB module updates from Teensyduino 1.18rc2.
Jacob Alexander <haata@kiibohd.com>
parents:
105
diff
changeset
|
13 * |
123
0c5d1fe99302
Adding CLI and CDC Serial support for Teensy 2.0 and Teensy 2.0++
Jacob Alexander <haata@kiibohd.com>
parents:
119
diff
changeset
|
14 * 1. The above copyright notice and this permission notice shall be |
117
5ffefdf89b37
Adding in USB module updates from Teensyduino 1.18rc2.
Jacob Alexander <haata@kiibohd.com>
parents:
105
diff
changeset
|
15 * included in all copies or substantial portions of the Software. |
5ffefdf89b37
Adding in USB module updates from Teensyduino 1.18rc2.
Jacob Alexander <haata@kiibohd.com>
parents:
105
diff
changeset
|
16 * |
123
0c5d1fe99302
Adding CLI and CDC Serial support for Teensy 2.0 and Teensy 2.0++
Jacob Alexander <haata@kiibohd.com>
parents:
119
diff
changeset
|
17 * 2. If the Software is incorporated into a build system that allows |
117
5ffefdf89b37
Adding in USB module updates from Teensyduino 1.18rc2.
Jacob Alexander <haata@kiibohd.com>
parents:
105
diff
changeset
|
18 * selection among a list of target devices, then similar target |
5ffefdf89b37
Adding in USB module updates from Teensyduino 1.18rc2.
Jacob Alexander <haata@kiibohd.com>
parents:
105
diff
changeset
|
19 * devices manufactured by PJRC.COM must be included in the list of |
5ffefdf89b37
Adding in USB module updates from Teensyduino 1.18rc2.
Jacob Alexander <haata@kiibohd.com>
parents:
105
diff
changeset
|
20 * target devices and selectable in the same manner. |
5ffefdf89b37
Adding in USB module updates from Teensyduino 1.18rc2.
Jacob Alexander <haata@kiibohd.com>
parents:
105
diff
changeset
|
21 * |
5ffefdf89b37
Adding in USB module updates from Teensyduino 1.18rc2.
Jacob Alexander <haata@kiibohd.com>
parents:
105
diff
changeset
|
22 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
5ffefdf89b37
Adding in USB module updates from Teensyduino 1.18rc2.
Jacob Alexander <haata@kiibohd.com>
parents:
105
diff
changeset
|
23 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
5ffefdf89b37
Adding in USB module updates from Teensyduino 1.18rc2.
Jacob Alexander <haata@kiibohd.com>
parents:
105
diff
changeset
|
24 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
5ffefdf89b37
Adding in USB module updates from Teensyduino 1.18rc2.
Jacob Alexander <haata@kiibohd.com>
parents:
105
diff
changeset
|
25 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
5ffefdf89b37
Adding in USB module updates from Teensyduino 1.18rc2.
Jacob Alexander <haata@kiibohd.com>
parents:
105
diff
changeset
|
26 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
5ffefdf89b37
Adding in USB module updates from Teensyduino 1.18rc2.
Jacob Alexander <haata@kiibohd.com>
parents:
105
diff
changeset
|
27 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
5ffefdf89b37
Adding in USB module updates from Teensyduino 1.18rc2.
Jacob Alexander <haata@kiibohd.com>
parents:
105
diff
changeset
|
28 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
5ffefdf89b37
Adding in USB module updates from Teensyduino 1.18rc2.
Jacob Alexander <haata@kiibohd.com>
parents:
105
diff
changeset
|
29 * SOFTWARE. |
5ffefdf89b37
Adding in USB module updates from Teensyduino 1.18rc2.
Jacob Alexander <haata@kiibohd.com>
parents:
105
diff
changeset
|
30 */ |
5ffefdf89b37
Adding in USB module updates from Teensyduino 1.18rc2.
Jacob Alexander <haata@kiibohd.com>
parents:
105
diff
changeset
|
31 |
341 | 32 #pragma once |
104
e84738d174bc
Moving USB to Output in preparation for additional Output types.
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
33 |
231
4afb170978e9
More preparation for NKRO USB for arm
Jacob Alexander <haata@kiibohd.com>
parents:
170
diff
changeset
|
34 // ----- Includes ----- |
104
e84738d174bc
Moving USB to Output in preparation for additional Output types.
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
35 |
231
4afb170978e9
More preparation for NKRO USB for arm
Jacob Alexander <haata@kiibohd.com>
parents:
170
diff
changeset
|
36 // Compiler Includes |
104
e84738d174bc
Moving USB to Output in preparation for additional Output types.
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
37 #include <stdint.h> |
e84738d174bc
Moving USB to Output in preparation for additional Output types.
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
38 #include <stddef.h> |
231
4afb170978e9
More preparation for NKRO USB for arm
Jacob Alexander <haata@kiibohd.com>
parents:
170
diff
changeset
|
39 |
4afb170978e9
More preparation for NKRO USB for arm
Jacob Alexander <haata@kiibohd.com>
parents:
170
diff
changeset
|
40 // Local Includes |
4afb170978e9
More preparation for NKRO USB for arm
Jacob Alexander <haata@kiibohd.com>
parents:
170
diff
changeset
|
41 #include <output_com.h> |
4afb170978e9
More preparation for NKRO USB for arm
Jacob Alexander <haata@kiibohd.com>
parents:
170
diff
changeset
|
42 |
4afb170978e9
More preparation for NKRO USB for arm
Jacob Alexander <haata@kiibohd.com>
parents:
170
diff
changeset
|
43 |
4afb170978e9
More preparation for NKRO USB for arm
Jacob Alexander <haata@kiibohd.com>
parents:
170
diff
changeset
|
44 |
4afb170978e9
More preparation for NKRO USB for arm
Jacob Alexander <haata@kiibohd.com>
parents:
170
diff
changeset
|
45 // ----- Defines ----- |
104
e84738d174bc
Moving USB to Output in preparation for additional Output types.
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
46 |
308 | 47 #define ENDPOINT_UNUSED 0x00 |
48 #define ENDPOINT_TRANSIMIT_ONLY 0x15 | |
49 #define ENDPOINT_RECEIVE_ONLY 0x19 | |
50 #define ENDPOINT_TRANSMIT_AND_RECEIVE 0x1D | |
104
e84738d174bc
Moving USB to Output in preparation for additional Output types.
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
51 |
119
814b5d3d7da6
Finished USB for Teensy 3.1 (Now 3.1 compatible!)
Jacob Alexander <haata@kiibohd.com>
parents:
117
diff
changeset
|
52 |
233
757e06368d0f
Fixing NKRO for Windows.
Jacob Alexander <haata@kiibohd.com>
parents:
231
diff
changeset
|
53 #define DEVICE_CLASS 0x00 // Keep 0x00 to indicate each sub device will indicate what it is |
231
4afb170978e9
More preparation for NKRO USB for arm
Jacob Alexander <haata@kiibohd.com>
parents:
170
diff
changeset
|
54 #define DEVICE_SUBCLASS 0x00 |
4afb170978e9
More preparation for NKRO USB for arm
Jacob Alexander <haata@kiibohd.com>
parents:
170
diff
changeset
|
55 #define DEVICE_PROTOCOL 0x00 |
170
85d74e5e1a95
More work on mk20dx128vlf5 port.
Jacob Alexander <haata@kiibohd.com>
parents:
123
diff
changeset
|
56 #define EP0_SIZE 64 |
449
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
57 #define NUM_ENDPOINTS 10 // XXX Can save some space if this can be calculated using KLL |
170
85d74e5e1a95
More work on mk20dx128vlf5 port.
Jacob Alexander <haata@kiibohd.com>
parents:
123
diff
changeset
|
58 #define NUM_USB_BUFFERS 30 |
449
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
59 |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
60 // XXX Remember to update total interface count, if it isn't correct some OSs will not initialize USB |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
61 // Linux warns in dmesg |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
62 // Mac OSX login screen will not initialize |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
63 #define KEYBOARD_INTERFACES 3 // Boot, NKRO, SysCtrl |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
64 #define CDC_INTERFACES 2 |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
65 #define MOUSE_INTERFACES 1 |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
66 #define JOYSTICK_INTERFACES 1 |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
67 #define RAWIO_INTERFACES 1 |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
68 |
123
0c5d1fe99302
Adding CLI and CDC Serial support for Teensy 2.0 and Teensy 2.0++
Jacob Alexander <haata@kiibohd.com>
parents:
119
diff
changeset
|
69 |
231
4afb170978e9
More preparation for NKRO USB for arm
Jacob Alexander <haata@kiibohd.com>
parents:
170
diff
changeset
|
70 #define KEYBOARD_INTERFACE 0 // Keyboard |
4afb170978e9
More preparation for NKRO USB for arm
Jacob Alexander <haata@kiibohd.com>
parents:
170
diff
changeset
|
71 #define KEYBOARD_ENDPOINT 1 |
4afb170978e9
More preparation for NKRO USB for arm
Jacob Alexander <haata@kiibohd.com>
parents:
170
diff
changeset
|
72 #define KEYBOARD_SIZE 8 |
4afb170978e9
More preparation for NKRO USB for arm
Jacob Alexander <haata@kiibohd.com>
parents:
170
diff
changeset
|
73 #define KEYBOARD_INTERVAL 1 |
368
06a54d582bf8
FIxing Media Keys and general USB compatibilty
Jacob Alexander <haata@kiibohd.com>
parents:
341
diff
changeset
|
74 #define KEYBOARD_NAME L"Boot Keyboard" |
231
4afb170978e9
More preparation for NKRO USB for arm
Jacob Alexander <haata@kiibohd.com>
parents:
170
diff
changeset
|
75 |
4afb170978e9
More preparation for NKRO USB for arm
Jacob Alexander <haata@kiibohd.com>
parents:
170
diff
changeset
|
76 #define NKRO_KEYBOARD_INTERFACE 1 // NKRO Keyboard |
4afb170978e9
More preparation for NKRO USB for arm
Jacob Alexander <haata@kiibohd.com>
parents:
170
diff
changeset
|
77 #define NKRO_KEYBOARD_ENDPOINT 2 |
235
decebaeea692
Setting max packet size (Interrupt) to 64 bytes
Jacob Alexander <haata@kiibohd.com>
parents:
233
diff
changeset
|
78 #define NKRO_KEYBOARD_SIZE 64 |
231
4afb170978e9
More preparation for NKRO USB for arm
Jacob Alexander <haata@kiibohd.com>
parents:
170
diff
changeset
|
79 #define NKRO_KEYBOARD_INTERVAL 1 |
368
06a54d582bf8
FIxing Media Keys and general USB compatibilty
Jacob Alexander <haata@kiibohd.com>
parents:
341
diff
changeset
|
80 #define NKRO_KEYBOARD_NAME L"NKRO Keyboard" |
231
4afb170978e9
More preparation for NKRO USB for arm
Jacob Alexander <haata@kiibohd.com>
parents:
170
diff
changeset
|
81 |
449
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
82 #define SYS_CTRL_INTERFACE 2 // Media Keys |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
83 #define SYS_CTRL_ENDPOINT 3 |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
84 #define SYS_CTRL_SIZE 8 |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
85 #define SYS_CTRL_INTERVAL 1 |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
86 #define SYS_CTRL_NAME L"Media Keys" |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
87 |
170
85d74e5e1a95
More work on mk20dx128vlf5 port.
Jacob Alexander <haata@kiibohd.com>
parents:
123
diff
changeset
|
88 #define CDC_IAD_DESCRIPTOR 1 |
449
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
89 #define CDC_STATUS_INTERFACE 3 |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
90 #define CDC_DATA_INTERFACE 4 // Serial |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
91 #define CDC_ACM_ENDPOINT 4 |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
92 #define CDC_RX_ENDPOINT 5 |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
93 #define CDC_TX_ENDPOINT 6 |
170
85d74e5e1a95
More work on mk20dx128vlf5 port.
Jacob Alexander <haata@kiibohd.com>
parents:
123
diff
changeset
|
94 #define CDC_ACM_SIZE 16 |
85d74e5e1a95
More work on mk20dx128vlf5 port.
Jacob Alexander <haata@kiibohd.com>
parents:
123
diff
changeset
|
95 #define CDC_RX_SIZE 64 |
85d74e5e1a95
More work on mk20dx128vlf5 port.
Jacob Alexander <haata@kiibohd.com>
parents:
123
diff
changeset
|
96 #define CDC_TX_SIZE 64 |
368
06a54d582bf8
FIxing Media Keys and general USB compatibilty
Jacob Alexander <haata@kiibohd.com>
parents:
341
diff
changeset
|
97 #define CDC_STATUS_NAME L"Virtual Serial Port - Status" |
06a54d582bf8
FIxing Media Keys and general USB compatibilty
Jacob Alexander <haata@kiibohd.com>
parents:
341
diff
changeset
|
98 #define CDC_DATA_NAME L"Virtual Serial Port - Data" |
123
0c5d1fe99302
Adding CLI and CDC Serial support for Teensy 2.0 and Teensy 2.0++
Jacob Alexander <haata@kiibohd.com>
parents:
119
diff
changeset
|
99 |
449
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
100 #define RAWIO_INTERFACE 5 // RawIO |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
101 #define RAWIO_TX_ENDPOINT 7 |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
102 #define RAWIO_TX_SIZE 64 |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
103 #define RAWIO_TX_INTERVAL 1 |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
104 #define RAWIO_RX_ENDPOINT 8 |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
105 #define RAWIO_RX_SIZE 64 |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
106 #define RAWIO_RX_INTERVAL 1 |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
107 #define RAWIO_NAME L"API Interface" |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
108 |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
109 #define MOUSE_INTERFACE 6 // Mouse |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
110 #define MOUSE_ENDPOINT 9 |
170
85d74e5e1a95
More work on mk20dx128vlf5 port.
Jacob Alexander <haata@kiibohd.com>
parents:
123
diff
changeset
|
111 #define MOUSE_SIZE 8 |
376 | 112 #define MOUSE_INTERVAL 1 |
368
06a54d582bf8
FIxing Media Keys and general USB compatibilty
Jacob Alexander <haata@kiibohd.com>
parents:
341
diff
changeset
|
113 #define MOUSE_NAME L"Mouse" |
123
0c5d1fe99302
Adding CLI and CDC Serial support for Teensy 2.0 and Teensy 2.0++
Jacob Alexander <haata@kiibohd.com>
parents:
119
diff
changeset
|
114 |
449
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
115 #define JOYSTICK_INTERFACE 7 // Joystick |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
116 #define JOYSTICK_ENDPOINT 10 |
170
85d74e5e1a95
More work on mk20dx128vlf5 port.
Jacob Alexander <haata@kiibohd.com>
parents:
123
diff
changeset
|
117 #define JOYSTICK_SIZE 16 |
85d74e5e1a95
More work on mk20dx128vlf5 port.
Jacob Alexander <haata@kiibohd.com>
parents:
123
diff
changeset
|
118 #define JOYSTICK_INTERVAL 1 |
368
06a54d582bf8
FIxing Media Keys and general USB compatibilty
Jacob Alexander <haata@kiibohd.com>
parents:
341
diff
changeset
|
119 #define JOYSTICK_NAME L"Joystick" |
06a54d582bf8
FIxing Media Keys and general USB compatibilty
Jacob Alexander <haata@kiibohd.com>
parents:
341
diff
changeset
|
120 |
449
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
121 |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
122 // Descriptor sizes |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
123 #define BASE_DESC_SIZE (9) |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
124 #define KEYBOARD_DESC_SIZE (9+9+7) |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
125 #define NKRO_KEYBOARD_DESC_SIZE (9+9+7) |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
126 #define SYS_CTRL_DESC_SIZE (9+9+7) |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
127 #define SERIAL_CDC_DESC_SIZE (8+9+5+5+4+5+7+9+7+7) |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
128 #define RAWIO_DESC_SIZE (9+7+7) |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
129 #define MOUSE_DESC_SIZE (9+9+7) |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
130 #define JOYSTICK_DESC_SIZE (9+9+7) |
123
0c5d1fe99302
Adding CLI and CDC Serial support for Teensy 2.0 and Teensy 2.0++
Jacob Alexander <haata@kiibohd.com>
parents:
119
diff
changeset
|
131 |
449
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
132 // Descriptor offsets |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
133 #define KEYBOARD_DESC_BASE_OFFSET ( \ |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
134 BASE_DESC_SIZE + \ |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
135 9 \ |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
136 ) |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
137 #define SERIAL_CDC_DESC_BASE_OFFSET ( \ |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
138 BASE_DESC_SIZE + \ |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
139 KEYBOARD_DESC_TOTAL_OFFSET + \ |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
140 8 \ |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
141 ) |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
142 #define RAWIO_DESC_BASE_OFFSET ( \ |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
143 BASE_DESC_SIZE + \ |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
144 KEYBOARD_DESC_TOTAL_OFFSET + \ |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
145 SERIAL_CDC_DESC_TOTAL_OFFSET + \ |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
146 9 \ |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
147 ) |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
148 #define MOUSE_DESC_BASE_OFFSET ( \ |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
149 BASE_DESC_SIZE + \ |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
150 KEYBOARD_DESC_TOTAL_OFFSET + \ |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
151 SERIAL_CDC_DESC_TOTAL_OFFSET + \ |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
152 9 \ |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
153 ) |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
154 #define JOYSTICK_DESC_BASE_OFFSET ( \ |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
155 BASE_DESC_SIZE + \ |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
156 KEYBOARD_DESC_TOTAL_OFFSET + \ |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
157 SERIAL_CDC_DESC_TOTAL_OFFSET + \ |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
158 MOUSE_DESC_TOTAL_OFFSET + \ |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
159 9 \ |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
160 ) |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
161 |
123
0c5d1fe99302
Adding CLI and CDC Serial support for Teensy 2.0 and Teensy 2.0++
Jacob Alexander <haata@kiibohd.com>
parents:
119
diff
changeset
|
162 |
308 | 163 #define ENDPOINT1_CONFIG ENDPOINT_TRANSIMIT_ONLY |
164 #define ENDPOINT2_CONFIG ENDPOINT_TRANSIMIT_ONLY | |
165 #define ENDPOINT3_CONFIG ENDPOINT_TRANSIMIT_ONLY | |
449
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
166 #define ENDPOINT4_CONFIG ENDPOINT_TRANSIMIT_ONLY |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
167 #define ENDPOINT5_CONFIG ENDPOINT_RECEIVE_ONLY |
308 | 168 #define ENDPOINT6_CONFIG ENDPOINT_TRANSIMIT_ONLY |
169 #define ENDPOINT7_CONFIG ENDPOINT_TRANSIMIT_ONLY | |
449
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
170 #define ENDPOINT8_CONFIG ENDPOINT_RECEIVE_ONLY |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
171 #define ENDPOINT9_CONFIG ENDPOINT_TRANSIMIT_ONLY |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
172 #define ENDPOINT10_CONFIG ENDPOINT_TRANSIMIT_ONLY |
104
e84738d174bc
Moving USB to Output in preparation for additional Output types.
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
173 |
e84738d174bc
Moving USB to Output in preparation for additional Output types.
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
174 |
231
4afb170978e9
More preparation for NKRO USB for arm
Jacob Alexander <haata@kiibohd.com>
parents:
170
diff
changeset
|
175 |
4afb170978e9
More preparation for NKRO USB for arm
Jacob Alexander <haata@kiibohd.com>
parents:
170
diff
changeset
|
176 // ----- Enumerations ----- |
104
e84738d174bc
Moving USB to Output in preparation for additional Output types.
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
177 |
e84738d174bc
Moving USB to Output in preparation for additional Output types.
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
178 typedef struct { |
308 | 179 uint16_t wValue; |
180 uint16_t wIndex; | |
181 const uint8_t *addr; | |
182 uint16_t length; | |
104
e84738d174bc
Moving USB to Output in preparation for additional Output types.
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
183 } usb_descriptor_list_t; |
e84738d174bc
Moving USB to Output in preparation for additional Output types.
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
184 |
231
4afb170978e9
More preparation for NKRO USB for arm
Jacob Alexander <haata@kiibohd.com>
parents:
170
diff
changeset
|
185 |
4afb170978e9
More preparation for NKRO USB for arm
Jacob Alexander <haata@kiibohd.com>
parents:
170
diff
changeset
|
186 |
4afb170978e9
More preparation for NKRO USB for arm
Jacob Alexander <haata@kiibohd.com>
parents:
170
diff
changeset
|
187 // ----- Variables ----- |
4afb170978e9
More preparation for NKRO USB for arm
Jacob Alexander <haata@kiibohd.com>
parents:
170
diff
changeset
|
188 |
4afb170978e9
More preparation for NKRO USB for arm
Jacob Alexander <haata@kiibohd.com>
parents:
170
diff
changeset
|
189 // NUM_ENDPOINTS = number of non-zero endpoints (0 to 15) |
4afb170978e9
More preparation for NKRO USB for arm
Jacob Alexander <haata@kiibohd.com>
parents:
170
diff
changeset
|
190 extern const uint8_t usb_endpoint_config_table[NUM_ENDPOINTS]; |
4afb170978e9
More preparation for NKRO USB for arm
Jacob Alexander <haata@kiibohd.com>
parents:
170
diff
changeset
|
191 |
104
e84738d174bc
Moving USB to Output in preparation for additional Output types.
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
192 extern const usb_descriptor_list_t usb_descriptor_list[]; |
e84738d174bc
Moving USB to Output in preparation for additional Output types.
Jacob Alexander <haata@kiibohd.com>
parents:
diff
changeset
|
193 |
420
23a1868b4ac2
Adding dynamic USB power support
Jacob Alexander <haata@kiibohd.com>
parents:
376
diff
changeset
|
194 extern uint8_t *usb_bMaxPower; |
23a1868b4ac2
Adding dynamic USB power support
Jacob Alexander <haata@kiibohd.com>
parents:
376
diff
changeset
|
195 |
449
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
196 |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
197 // ----- Functions ----- |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
198 |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
199 void usb_set_config_descriptor_size(); |
45feb80a2ad1
Major USB update, fixes most (if not all) known issues
Jacob Alexander <haata@kiibohd.com>
parents:
420
diff
changeset
|
200 |