May not work well
Dependencies: USBDevice_edit mbed
USBJoystick.cpp@0:7e061992d951, 2017-05-04 (annotated)
- Committer:
- Ugly_Kid
- Date:
- Thu May 04 13:37:26 2017 +0000
- Revision:
- 0:7e061992d951
Teste de USB_HID
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Ugly_Kid | 0:7e061992d951 | 1 | /* Copyright (c) 2010-2011 mbed.org, MIT License |
Ugly_Kid | 0:7e061992d951 | 2 | * Modified Mouse code for Joystick - WH 2012 |
Ugly_Kid | 0:7e061992d951 | 3 | * |
Ugly_Kid | 0:7e061992d951 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
Ugly_Kid | 0:7e061992d951 | 5 | * and associated documentation files (the "Software"), to deal in the Software without |
Ugly_Kid | 0:7e061992d951 | 6 | * restriction, including without limitation the rights to use, copy, modify, merge, publish, |
Ugly_Kid | 0:7e061992d951 | 7 | * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the |
Ugly_Kid | 0:7e061992d951 | 8 | * Software is furnished to do so, subject to the following conditions: |
Ugly_Kid | 0:7e061992d951 | 9 | * |
Ugly_Kid | 0:7e061992d951 | 10 | * The above copyright notice and this permission notice shall be included in all copies or |
Ugly_Kid | 0:7e061992d951 | 11 | * substantial portions of the Software. |
Ugly_Kid | 0:7e061992d951 | 12 | * |
Ugly_Kid | 0:7e061992d951 | 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
Ugly_Kid | 0:7e061992d951 | 14 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
Ugly_Kid | 0:7e061992d951 | 15 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
Ugly_Kid | 0:7e061992d951 | 16 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
Ugly_Kid | 0:7e061992d951 | 17 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
Ugly_Kid | 0:7e061992d951 | 18 | */ |
Ugly_Kid | 0:7e061992d951 | 19 | |
Ugly_Kid | 0:7e061992d951 | 20 | #include "stdint.h" |
Ugly_Kid | 0:7e061992d951 | 21 | #include "USBJoystick.h" |
Ugly_Kid | 0:7e061992d951 | 22 | |
Ugly_Kid | 0:7e061992d951 | 23 | bool USBJoystick::update(int16_t t, int16_t r, int16_t x, int16_t y, uint8_t button, uint8_t hat) { |
Ugly_Kid | 0:7e061992d951 | 24 | HID_REPORT report; |
Ugly_Kid | 0:7e061992d951 | 25 | _t = t; |
Ugly_Kid | 0:7e061992d951 | 26 | _r = r; |
Ugly_Kid | 0:7e061992d951 | 27 | _x = x; |
Ugly_Kid | 0:7e061992d951 | 28 | _y = y; |
Ugly_Kid | 0:7e061992d951 | 29 | _button = button; |
Ugly_Kid | 0:7e061992d951 | 30 | _hat = hat; |
Ugly_Kid | 0:7e061992d951 | 31 | |
Ugly_Kid | 0:7e061992d951 | 32 | // Fill the report according to the Joystick Descriptor |
Ugly_Kid | 0:7e061992d951 | 33 | /* |
Ugly_Kid | 0:7e061992d951 | 34 | report.data[0] = _t & 0xff; |
Ugly_Kid | 0:7e061992d951 | 35 | report.data[1] = _r & 0xff; |
Ugly_Kid | 0:7e061992d951 | 36 | report.data[2] = _x & 0xff; |
Ugly_Kid | 0:7e061992d951 | 37 | report.data[3] = __x & 0xff; |
Ugly_Kid | 0:7e061992d951 | 38 | report.data[4] = ((_button & 0x0f) << 4) | (_hat & 0x0f) ; |
Ugly_Kid | 0:7e061992d951 | 39 | report.length = 5; |
Ugly_Kid | 0:7e061992d951 | 40 | */ |
Ugly_Kid | 0:7e061992d951 | 41 | // Fill the report according to the Joystick Descriptor |
Ugly_Kid | 0:7e061992d951 | 42 | report.data[0] = 0x01; // report_id |
Ugly_Kid | 0:7e061992d951 | 43 | report.data[1] = 0x00; //reserved |
Ugly_Kid | 0:7e061992d951 | 44 | report.data[2] = (_button & 0x0f) << 4 | (_button & 0x0f) ; // buttons 1 - 8 ab |
Ugly_Kid | 0:7e061992d951 | 45 | //report.data[3] = ((_button & 0x0f) << 4) | (_hat & 0x0f) ;; // buttons 17 - 19 / filling bits 1 -5 ef |
Ugly_Kid | 0:7e061992d951 | 46 | report.data[3] = (_button & 0x0f) << 4 | (_button & 0x0f) ; //buttons 9 - 16 cd sq x 0 tr |
Ugly_Kid | 0:7e061992d951 | 47 | report.data[4] = (_button & 0x0f); // buttons 17 - 19 / filling bits 1 -5 ef |
Ugly_Kid | 0:7e061992d951 | 48 | report.data[5] = 0x00; // filling bits 6 - 13 / 32 bits total |
Ugly_Kid | 0:7e061992d951 | 49 | report.data[6] = _t & 0xff; // X |
Ugly_Kid | 0:7e061992d951 | 50 | report.data[7] = _r & 0xff; // Y |
Ugly_Kid | 0:7e061992d951 | 51 | report.data[8] = _x & 0xff; // Z |
Ugly_Kid | 0:7e061992d951 | 52 | report.data[9] = _y & 0xff; // Rz |
Ugly_Kid | 0:7e061992d951 | 53 | report.data[10] = _y & 0xff; |
Ugly_Kid | 0:7e061992d951 | 54 | report.data[11] = _y & 0xff; |
Ugly_Kid | 0:7e061992d951 | 55 | report.data[12] = _y & 0xff;// directional analog up |
Ugly_Kid | 0:7e061992d951 | 56 | report.data[13] = _y & 0xff;// directional analog left |
Ugly_Kid | 0:7e061992d951 | 57 | report.data[14] = _y & 0xff;// directional analog down |
Ugly_Kid | 0:7e061992d951 | 58 | report.data[15] = _y & 0xff;// directional analog right |
Ugly_Kid | 0:7e061992d951 | 59 | report.data[16] = _y & 0xff;// analog left 2 |
Ugly_Kid | 0:7e061992d951 | 60 | report.data[17] = _y & 0xff;// analog right 2 |
Ugly_Kid | 0:7e061992d951 | 61 | report.data[18] = _y & 0xff;// analog left 1 |
Ugly_Kid | 0:7e061992d951 | 62 | report.data[19] = _y & 0xff;// analog right 1 |
Ugly_Kid | 0:7e061992d951 | 63 | report.data[20] = _y & 0xff;// triangle analog |
Ugly_Kid | 0:7e061992d951 | 64 | report.data[21] = _y & 0xff;// circle analog |
Ugly_Kid | 0:7e061992d951 | 65 | report.data[22] = _y & 0xff;// x analog |
Ugly_Kid | 0:7e061992d951 | 66 | report.data[23] = _y & 0xff;// square analog |
Ugly_Kid | 0:7e061992d951 | 67 | report.data[24] = _y & 0xff; |
Ugly_Kid | 0:7e061992d951 | 68 | report.data[25] = _y & 0xff; |
Ugly_Kid | 0:7e061992d951 | 69 | report.data[26] = _y & 0xff; |
Ugly_Kid | 0:7e061992d951 | 70 | report.data[27] = _y & 0xff; // 03 ? |
Ugly_Kid | 0:7e061992d951 | 71 | report.data[28] = _y & 0xff; // ef ? |
Ugly_Kid | 0:7e061992d951 | 72 | report.data[29] = _y & 0xff; // 16 ? |
Ugly_Kid | 0:7e061992d951 | 73 | report.data[30] = _y & 0xff; |
Ugly_Kid | 0:7e061992d951 | 74 | report.data[31] = _y & 0xff; |
Ugly_Kid | 0:7e061992d951 | 75 | report.data[32] = _y & 0xff; |
Ugly_Kid | 0:7e061992d951 | 76 | report.data[33] = _y & 0xff; |
Ugly_Kid | 0:7e061992d951 | 77 | report.data[34] = _y & 0xff;//Accel x 4 |
Ugly_Kid | 0:7e061992d951 | 78 | report.data[35] = _y & 0xff;//Accel x 3 |
Ugly_Kid | 0:7e061992d951 | 79 | report.data[36] = _y & 0xff;//Accel x 2 |
Ugly_Kid | 0:7e061992d951 | 80 | report.data[37] = _y & 0xff;//Accel x 1 |
Ugly_Kid | 0:7e061992d951 | 81 | report.data[38] = _y & 0xff;//Accel y 4 |
Ugly_Kid | 0:7e061992d951 | 82 | report.data[39] = _y & 0xff;//Accel y 3 |
Ugly_Kid | 0:7e061992d951 | 83 | report.data[40] = _y & 0xff;//Accel y 2 |
Ugly_Kid | 0:7e061992d951 | 84 | report.data[41] = _y & 0xff;//Accel y 1 |
Ugly_Kid | 0:7e061992d951 | 85 | report.data[42] = _y & 0xff;//Accel z 4 |
Ugly_Kid | 0:7e061992d951 | 86 | report.data[43] = _y & 0xff;//Accel z 3 |
Ugly_Kid | 0:7e061992d951 | 87 | report.data[44] = _y & 0xff;//Accel z 2 |
Ugly_Kid | 0:7e061992d951 | 88 | report.data[45] = _y & 0xff;//Accel z 1 |
Ugly_Kid | 0:7e061992d951 | 89 | report.data[46] = _y & 0xff; |
Ugly_Kid | 0:7e061992d951 | 90 | report.data[47] = _y & 0xff; |
Ugly_Kid | 0:7e061992d951 | 91 | report.data[48] = _y & 0xff; |
Ugly_Kid | 0:7e061992d951 | 92 | |
Ugly_Kid | 0:7e061992d951 | 93 | report.length = 49; |
Ugly_Kid | 0:7e061992d951 | 94 | |
Ugly_Kid | 0:7e061992d951 | 95 | |
Ugly_Kid | 0:7e061992d951 | 96 | return send(&report); |
Ugly_Kid | 0:7e061992d951 | 97 | |
Ugly_Kid | 0:7e061992d951 | 98 | } |
Ugly_Kid | 0:7e061992d951 | 99 | /* |
Ugly_Kid | 0:7e061992d951 | 100 | bool USBJoystick::update() { |
Ugly_Kid | 0:7e061992d951 | 101 | HID_REPORT report; |
Ugly_Kid | 0:7e061992d951 | 102 | |
Ugly_Kid | 0:7e061992d951 | 103 | // Fill the report according to the Joystick Descriptor |
Ugly_Kid | 0:7e061992d951 | 104 | report.data[0] = _t & 0xff; |
Ugly_Kid | 0:7e061992d951 | 105 | report.data[1] = _r & 0xff; |
Ugly_Kid | 0:7e061992d951 | 106 | report.data[2] = _x & 0xff; |
Ugly_Kid | 0:7e061992d951 | 107 | report.data[3] = _y & 0xff; |
Ugly_Kid | 0:7e061992d951 | 108 | report.data[4] = ((_button & 0x0f) << 4) | (_hat & 0x0f) ; |
Ugly_Kid | 0:7e061992d951 | 109 | report.length = 5; |
Ugly_Kid | 0:7e061992d951 | 110 | |
Ugly_Kid | 0:7e061992d951 | 111 | return send(&report); |
Ugly_Kid | 0:7e061992d951 | 112 | } |
Ugly_Kid | 0:7e061992d951 | 113 | */ |
Ugly_Kid | 0:7e061992d951 | 114 | bool USBJoystick::update() { |
Ugly_Kid | 0:7e061992d951 | 115 | HID_REPORT report; |
Ugly_Kid | 0:7e061992d951 | 116 | |
Ugly_Kid | 0:7e061992d951 | 117 | // Fill the report according to the Joystick Descriptor |
Ugly_Kid | 0:7e061992d951 | 118 | /* //report.data[0] = 0x01; |
Ugly_Kid | 0:7e061992d951 | 119 | report.data[0] = _t & 0xff; |
Ugly_Kid | 0:7e061992d951 | 120 | report.data[1] = _r & 0xff; |
Ugly_Kid | 0:7e061992d951 | 121 | report.data[2] = _x & 0xff; |
Ugly_Kid | 0:7e061992d951 | 122 | report.data[3] = _y & 0xff; |
Ugly_Kid | 0:7e061992d951 | 123 | report.data[4] = ((_button & 0x0f) << 4) | (_hat & 0x0f) ; |
Ugly_Kid | 0:7e061992d951 | 124 | */ |
Ugly_Kid | 0:7e061992d951 | 125 | // Fill the report according to the Joystick Descriptor |
Ugly_Kid | 0:7e061992d951 | 126 | report.data[0] = 0x01; //reserved |
Ugly_Kid | 0:7e061992d951 | 127 | report.data[1] = 0x00;; // buttons 1 - 8 |
Ugly_Kid | 0:7e061992d951 | 128 | report.data[2] = 0x00; // buttons 9 - 16 |
Ugly_Kid | 0:7e061992d951 | 129 | report.data[3] = 0x00; // buttons 17 - 19 / filling bits 1 -5 |
Ugly_Kid | 0:7e061992d951 | 130 | report.data[4] = 0x00; // filling bits 6 - 13 / 32 bits total |
Ugly_Kid | 0:7e061992d951 | 131 | report.data[5] = 0x7d; // X |
Ugly_Kid | 0:7e061992d951 | 132 | report.data[6] = 0x7d; // Y |
Ugly_Kid | 0:7e061992d951 | 133 | report.data[7] = 0x7d; // Z |
Ugly_Kid | 0:7e061992d951 | 134 | report.data[8] = 0x80; // Rz |
Ugly_Kid | 0:7e061992d951 | 135 | report.data[9] = 0x00; |
Ugly_Kid | 0:7e061992d951 | 136 | report.data[10] = 0x00; |
Ugly_Kid | 0:7e061992d951 | 137 | report.data[11] = 0x00; |
Ugly_Kid | 0:7e061992d951 | 138 | report.data[12] = 0x00;// directional analog up |
Ugly_Kid | 0:7e061992d951 | 139 | report.data[13] = 0x00;// directional analog left |
Ugly_Kid | 0:7e061992d951 | 140 | report.data[14] = 0x00;// directional analog down |
Ugly_Kid | 0:7e061992d951 | 141 | report.data[15] = 0x00;// directional analog right |
Ugly_Kid | 0:7e061992d951 | 142 | report.data[16] = 0x00;// analog left 2 |
Ugly_Kid | 0:7e061992d951 | 143 | report.data[17] = 0x00;// analog right 2 |
Ugly_Kid | 0:7e061992d951 | 144 | report.data[18] = 0x00;// analog left 1 |
Ugly_Kid | 0:7e061992d951 | 145 | report.data[19] = 0x00;// analog right 1 |
Ugly_Kid | 0:7e061992d951 | 146 | report.data[20] = 0x00;// triangle analog |
Ugly_Kid | 0:7e061992d951 | 147 | report.data[21] = 0x00;// circle analog |
Ugly_Kid | 0:7e061992d951 | 148 | report.data[22] = 0x00;// x analog |
Ugly_Kid | 0:7e061992d951 | 149 | report.data[23] = 0x00;// square analog |
Ugly_Kid | 0:7e061992d951 | 150 | report.data[24] = 0x00; |
Ugly_Kid | 0:7e061992d951 | 151 | report.data[25] = 0x00; |
Ugly_Kid | 0:7e061992d951 | 152 | report.data[26] = 0x00; |
Ugly_Kid | 0:7e061992d951 | 153 | report.data[27] = 0x00; // 03 ? |
Ugly_Kid | 0:7e061992d951 | 154 | report.data[28] = 0x00; // ef ? |
Ugly_Kid | 0:7e061992d951 | 155 | report.data[29] = 0x00; // 16 ? |
Ugly_Kid | 0:7e061992d951 | 156 | report.data[30] = 0x00; |
Ugly_Kid | 0:7e061992d951 | 157 | report.data[31] = 0x00; |
Ugly_Kid | 0:7e061992d951 | 158 | report.data[32] = 0x00; |
Ugly_Kid | 0:7e061992d951 | 159 | report.data[33] = 0x00; |
Ugly_Kid | 0:7e061992d951 | 160 | report.data[34] = 0x00;//Accel x 4 |
Ugly_Kid | 0:7e061992d951 | 161 | report.data[35] = 0x00;//Accel x 3 |
Ugly_Kid | 0:7e061992d951 | 162 | report.data[36] = 0x00;//Accel x 2 |
Ugly_Kid | 0:7e061992d951 | 163 | report.data[37] = 0x00;//Accel x 1 |
Ugly_Kid | 0:7e061992d951 | 164 | report.data[38] = 0x00;//Accel y 4 |
Ugly_Kid | 0:7e061992d951 | 165 | report.data[39] = 0x00;//Accel y 3 |
Ugly_Kid | 0:7e061992d951 | 166 | report.data[40] = 0x00;//Accel y 2 |
Ugly_Kid | 0:7e061992d951 | 167 | report.data[41] = 0x00;//Accel y 1 |
Ugly_Kid | 0:7e061992d951 | 168 | report.data[42] = 0x00;//Accel z 4 |
Ugly_Kid | 0:7e061992d951 | 169 | report.data[43] = 0x00;//Accel z 3 |
Ugly_Kid | 0:7e061992d951 | 170 | report.data[44] = 0x00;//Accel z 2 |
Ugly_Kid | 0:7e061992d951 | 171 | report.data[45] = 0x00;//Accel z 1 |
Ugly_Kid | 0:7e061992d951 | 172 | report.data[46] = 0x00; |
Ugly_Kid | 0:7e061992d951 | 173 | report.data[47] = 0x00; |
Ugly_Kid | 0:7e061992d951 | 174 | report.data[48] = 0x00; |
Ugly_Kid | 0:7e061992d951 | 175 | |
Ugly_Kid | 0:7e061992d951 | 176 | report.length = 49; |
Ugly_Kid | 0:7e061992d951 | 177 | |
Ugly_Kid | 0:7e061992d951 | 178 | return send(&report); |
Ugly_Kid | 0:7e061992d951 | 179 | } |
Ugly_Kid | 0:7e061992d951 | 180 | |
Ugly_Kid | 0:7e061992d951 | 181 | bool USBJoystick::throttle(int16_t t) { |
Ugly_Kid | 0:7e061992d951 | 182 | _t = t; |
Ugly_Kid | 0:7e061992d951 | 183 | return update(); |
Ugly_Kid | 0:7e061992d951 | 184 | } |
Ugly_Kid | 0:7e061992d951 | 185 | |
Ugly_Kid | 0:7e061992d951 | 186 | bool USBJoystick::rudder(int16_t r) { |
Ugly_Kid | 0:7e061992d951 | 187 | _r = r; |
Ugly_Kid | 0:7e061992d951 | 188 | return update(); |
Ugly_Kid | 0:7e061992d951 | 189 | } |
Ugly_Kid | 0:7e061992d951 | 190 | |
Ugly_Kid | 0:7e061992d951 | 191 | bool USBJoystick::move(int16_t x, int16_t y) { |
Ugly_Kid | 0:7e061992d951 | 192 | _x = x; |
Ugly_Kid | 0:7e061992d951 | 193 | _y = y; |
Ugly_Kid | 0:7e061992d951 | 194 | return update(); |
Ugly_Kid | 0:7e061992d951 | 195 | } |
Ugly_Kid | 0:7e061992d951 | 196 | |
Ugly_Kid | 0:7e061992d951 | 197 | bool USBJoystick::button(uint8_t button) { |
Ugly_Kid | 0:7e061992d951 | 198 | _button = button; |
Ugly_Kid | 0:7e061992d951 | 199 | return update(); |
Ugly_Kid | 0:7e061992d951 | 200 | } |
Ugly_Kid | 0:7e061992d951 | 201 | |
Ugly_Kid | 0:7e061992d951 | 202 | bool USBJoystick::hat(uint8_t hat) { |
Ugly_Kid | 0:7e061992d951 | 203 | _hat = hat; |
Ugly_Kid | 0:7e061992d951 | 204 | return update(); |
Ugly_Kid | 0:7e061992d951 | 205 | } |
Ugly_Kid | 0:7e061992d951 | 206 | |
Ugly_Kid | 0:7e061992d951 | 207 | |
Ugly_Kid | 0:7e061992d951 | 208 | void USBJoystick::_init() { |
Ugly_Kid | 0:7e061992d951 | 209 | |
Ugly_Kid | 0:7e061992d951 | 210 | _t = -127; |
Ugly_Kid | 0:7e061992d951 | 211 | _r = -127; |
Ugly_Kid | 0:7e061992d951 | 212 | _x = 0; |
Ugly_Kid | 0:7e061992d951 | 213 | _y = 0; |
Ugly_Kid | 0:7e061992d951 | 214 | _button = 0x0f; |
Ugly_Kid | 0:7e061992d951 | 215 | _hat = 0x00; |
Ugly_Kid | 0:7e061992d951 | 216 | } |
Ugly_Kid | 0:7e061992d951 | 217 | |
Ugly_Kid | 0:7e061992d951 | 218 | |
Ugly_Kid | 0:7e061992d951 | 219 | uint8_t * USBJoystick::reportDesc() { |
Ugly_Kid | 0:7e061992d951 | 220 | static uint8_t reportDescriptor[] = { |
Ugly_Kid | 0:7e061992d951 | 221 | |
Ugly_Kid | 0:7e061992d951 | 222 | 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) |
Ugly_Kid | 0:7e061992d951 | 223 | 0x09, 0x04, // Usage (Joystick) |
Ugly_Kid | 0:7e061992d951 | 224 | 0xA1, 0x01, // Collection (Physical) |
Ugly_Kid | 0:7e061992d951 | 225 | 0xA1, 0x02, // Collection (Application) |
Ugly_Kid | 0:7e061992d951 | 226 | 0x85, 0x01, // Report ID (1) |
Ugly_Kid | 0:7e061992d951 | 227 | 0x75, 0x08, // Report Size (8) |
Ugly_Kid | 0:7e061992d951 | 228 | 0x95, 0x01, // Report Count (1) //byte 00 |
Ugly_Kid | 0:7e061992d951 | 229 | 0x15, 0x00, // Logical Minimum (0) |
Ugly_Kid | 0:7e061992d951 | 230 | 0x26, 0xFF, 0x00, // Logical Maximum (255) |
Ugly_Kid | 0:7e061992d951 | 231 | 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) |
Ugly_Kid | 0:7e061992d951 | 232 | // NOTE: reserved byte |
Ugly_Kid | 0:7e061992d951 | 233 | 0x75, 0x01, // Report Size (1) |
Ugly_Kid | 0:7e061992d951 | 234 | 0x95, 0x13, // Report Count (19) |
Ugly_Kid | 0:7e061992d951 | 235 | 0x15, 0x00, // Logical Minimum (0) |
Ugly_Kid | 0:7e061992d951 | 236 | 0x25, 0x01, // Logical Maximum (1) |
Ugly_Kid | 0:7e061992d951 | 237 | 0x35, 0x00, // Physical Minimum (0) |
Ugly_Kid | 0:7e061992d951 | 238 | 0x45, 0x01, // Physical Maximum (1) |
Ugly_Kid | 0:7e061992d951 | 239 | 0x05, 0x09, // Usage Page (Button) |
Ugly_Kid | 0:7e061992d951 | 240 | 0x19, 0x01, // Usage Minimum (0x01) |
Ugly_Kid | 0:7e061992d951 | 241 | 0x29, 0x13, // Usage Maximum (0x13) |
Ugly_Kid | 0:7e061992d951 | 242 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) |
Ugly_Kid | 0:7e061992d951 | 243 | 0x75, 0x01, // Report Size (1) |
Ugly_Kid | 0:7e061992d951 | 244 | 0x95, 0x0D, // Report Count (13) // byte 1 - 4 |
Ugly_Kid | 0:7e061992d951 | 245 | 0x06, 0x00, 0xFF, // Usage Page (Vendor Defined 0xFF00) |
Ugly_Kid | 0:7e061992d951 | 246 | 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) |
Ugly_Kid | 0:7e061992d951 | 247 | // NOTE: 32 bit integer, where 0:18 are buttons and 19:31 are reserved |
Ugly_Kid | 0:7e061992d951 | 248 | 0x15, 0x00, // Logical Minimum (0) |
Ugly_Kid | 0:7e061992d951 | 249 | 0x26, 0xFF, 0x00, // Logical Maximum (255) |
Ugly_Kid | 0:7e061992d951 | 250 | 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) |
Ugly_Kid | 0:7e061992d951 | 251 | 0x09, 0x01, // Usage (Pointer) |
Ugly_Kid | 0:7e061992d951 | 252 | 0xA1, 0x00, // Collection (Undefined) |
Ugly_Kid | 0:7e061992d951 | 253 | 0x75, 0x08, // Report Size (8) |
Ugly_Kid | 0:7e061992d951 | 254 | 0x95, 0x04, // Report Count (4) |
Ugly_Kid | 0:7e061992d951 | 255 | 0x35, 0x00, // Physical Minimum (0) |
Ugly_Kid | 0:7e061992d951 | 256 | 0x46, 0xFF, 0x00, // Physical Maximum (255) |
Ugly_Kid | 0:7e061992d951 | 257 | 0x09, 0x30, // Usage (X) |
Ugly_Kid | 0:7e061992d951 | 258 | 0x09, 0x31, // Usage (Y) |
Ugly_Kid | 0:7e061992d951 | 259 | 0x09, 0x32, // Usage (Z) |
Ugly_Kid | 0:7e061992d951 | 260 | 0x09, 0x35, // Usage (Rz) |
Ugly_Kid | 0:7e061992d951 | 261 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) |
Ugly_Kid | 0:7e061992d951 | 262 | // NOTE: four joysticks |
Ugly_Kid | 0:7e061992d951 | 263 | 0xC0, // End Collection |
Ugly_Kid | 0:7e061992d951 | 264 | 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) |
Ugly_Kid | 0:7e061992d951 | 265 | 0x75, 0x08, // Report Size (8) |
Ugly_Kid | 0:7e061992d951 | 266 | 0x95, 0x27, // Report Count (39) |
Ugly_Kid | 0:7e061992d951 | 267 | 0x09, 0x01, // Usage (Pointer) |
Ugly_Kid | 0:7e061992d951 | 268 | 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) |
Ugly_Kid | 0:7e061992d951 | 269 | //0xC0, // End Collection |
Ugly_Kid | 0:7e061992d951 | 270 | //0xC0 // End Collection |
Ugly_Kid | 0:7e061992d951 | 271 | |
Ugly_Kid | 0:7e061992d951 | 272 | 0x75, 0x08, // Report Size (8) |
Ugly_Kid | 0:7e061992d951 | 273 | 0x95, 0x30, // Report Count (48) |
Ugly_Kid | 0:7e061992d951 | 274 | 0x09, 0x01, // Usage (Pointer) |
Ugly_Kid | 0:7e061992d951 | 275 | 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) |
Ugly_Kid | 0:7e061992d951 | 276 | 0x75, 0x08, // Report Size (8) |
Ugly_Kid | 0:7e061992d951 | 277 | 0x95, 0x30, // Report Count (48) |
Ugly_Kid | 0:7e061992d951 | 278 | 0x09, 0x01, // Usage (Pointer) |
Ugly_Kid | 0:7e061992d951 | 279 | 0xB1, 0x02, // Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) |
Ugly_Kid | 0:7e061992d951 | 280 | 0xC0, // End Collection |
Ugly_Kid | 0:7e061992d951 | 281 | 0xA1, 0x02, // Collection (Application) |
Ugly_Kid | 0:7e061992d951 | 282 | 0x85, 0x02, // Report ID (2) |
Ugly_Kid | 0:7e061992d951 | 283 | 0x75, 0x08, // Report Size (8) |
Ugly_Kid | 0:7e061992d951 | 284 | 0x95, 0x30, // Report Count (48) |
Ugly_Kid | 0:7e061992d951 | 285 | 0x09, 0x01, // Usage (Pointer) |
Ugly_Kid | 0:7e061992d951 | 286 | 0xB1, 0x02, // Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) |
Ugly_Kid | 0:7e061992d951 | 287 | 0xC0, // End Collection |
Ugly_Kid | 0:7e061992d951 | 288 | 0xA1, 0x02, // Collection (Application) |
Ugly_Kid | 0:7e061992d951 | 289 | 0x85, 0xEE, // Report ID (238) |
Ugly_Kid | 0:7e061992d951 | 290 | 0x75, 0x08, // Report Size (8) |
Ugly_Kid | 0:7e061992d951 | 291 | 0x95, 0x30, // Report Count (48) |
Ugly_Kid | 0:7e061992d951 | 292 | 0x09, 0x01, // Usage (Pointer) |
Ugly_Kid | 0:7e061992d951 | 293 | 0xB1, 0x02, // Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) |
Ugly_Kid | 0:7e061992d951 | 294 | 0xC0, // End Collection |
Ugly_Kid | 0:7e061992d951 | 295 | 0xA1, 0x02, // Collection (Application) |
Ugly_Kid | 0:7e061992d951 | 296 | 0x85, 0xEF, // Report ID (239) |
Ugly_Kid | 0:7e061992d951 | 297 | 0x75, 0x08, // Report Size (8) |
Ugly_Kid | 0:7e061992d951 | 298 | 0x95, 0x30, // Report Count (48) |
Ugly_Kid | 0:7e061992d951 | 299 | 0x09, 0x01, // Usage (Pointer) |
Ugly_Kid | 0:7e061992d951 | 300 | 0xB1, 0x02, // Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) |
Ugly_Kid | 0:7e061992d951 | 301 | 0xC0, // End Collection |
Ugly_Kid | 0:7e061992d951 | 302 | 0xC0, // End Collection |
Ugly_Kid | 0:7e061992d951 | 303 | |
Ugly_Kid | 0:7e061992d951 | 304 | // 148 bytes |
Ugly_Kid | 0:7e061992d951 | 305 | |
Ugly_Kid | 0:7e061992d951 | 306 | }; |
Ugly_Kid | 0:7e061992d951 | 307 | |
Ugly_Kid | 0:7e061992d951 | 308 | reportLength = sizeof(reportDescriptor); |
Ugly_Kid | 0:7e061992d951 | 309 | return reportDescriptor; |
Ugly_Kid | 0:7e061992d951 | 310 | } |
Ugly_Kid | 0:7e061992d951 | 311 | |
Ugly_Kid | 0:7e061992d951 | 312 |