Pinscape Controller version 1 fork. This is a fork to allow for ongoing bug fixes to the original controller version, from before the major changes for the expansion board project.

Dependencies:   FastIO FastPWM SimpleDMA mbed

Fork of Pinscape_Controller by Mike R

Committer:
mjr
Date:
Thu Feb 11 18:12:52 2016 +0000
Revision:
52:63f0a9b45f0c
Child:
53:02408ec83097
Convert FastAnalogIn and USBDevice libraries to folders

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mjr 52:63f0a9b45f0c 1 /* Copyright (c) 2010-2011 mbed.org, MIT License
mjr 52:63f0a9b45f0c 2 *
mjr 52:63f0a9b45f0c 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
mjr 52:63f0a9b45f0c 4 * and associated documentation files (the "Software"), to deal in the Software without
mjr 52:63f0a9b45f0c 5 * restriction, including without limitation the rights to use, copy, modify, merge, publish,
mjr 52:63f0a9b45f0c 6 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
mjr 52:63f0a9b45f0c 7 * Software is furnished to do so, subject to the following conditions:
mjr 52:63f0a9b45f0c 8 *
mjr 52:63f0a9b45f0c 9 * The above copyright notice and this permission notice shall be included in all copies or
mjr 52:63f0a9b45f0c 10 * substantial portions of the Software.
mjr 52:63f0a9b45f0c 11 *
mjr 52:63f0a9b45f0c 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
mjr 52:63f0a9b45f0c 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
mjr 52:63f0a9b45f0c 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
mjr 52:63f0a9b45f0c 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
mjr 52:63f0a9b45f0c 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
mjr 52:63f0a9b45f0c 17 */
mjr 52:63f0a9b45f0c 18
mjr 52:63f0a9b45f0c 19 #include "stdint.h"
mjr 52:63f0a9b45f0c 20 #include "USBHAL.h"
mjr 52:63f0a9b45f0c 21 #include "USBHID.h"
mjr 52:63f0a9b45f0c 22
mjr 52:63f0a9b45f0c 23
mjr 52:63f0a9b45f0c 24 USBHID::USBHID(uint8_t output_report_length, uint8_t input_report_length, uint16_t vendor_id, uint16_t product_id, uint16_t product_release, bool connect): USBDevice(vendor_id, product_id, product_release)
mjr 52:63f0a9b45f0c 25 {
mjr 52:63f0a9b45f0c 26 output_length = output_report_length;
mjr 52:63f0a9b45f0c 27 input_length = input_report_length;
mjr 52:63f0a9b45f0c 28 if(connect) {
mjr 52:63f0a9b45f0c 29 USBDevice::connect();
mjr 52:63f0a9b45f0c 30 }
mjr 52:63f0a9b45f0c 31 }
mjr 52:63f0a9b45f0c 32
mjr 52:63f0a9b45f0c 33
mjr 52:63f0a9b45f0c 34 bool USBHID::send(HID_REPORT *report)
mjr 52:63f0a9b45f0c 35 {
mjr 52:63f0a9b45f0c 36 return write(EPINT_IN, report->data, report->length, MAX_HID_REPORT_SIZE);
mjr 52:63f0a9b45f0c 37 }
mjr 52:63f0a9b45f0c 38
mjr 52:63f0a9b45f0c 39 bool USBHID::sendNB(HID_REPORT *report)
mjr 52:63f0a9b45f0c 40 {
mjr 52:63f0a9b45f0c 41 return writeNB(EPINT_IN, report->data, report->length, MAX_HID_REPORT_SIZE);
mjr 52:63f0a9b45f0c 42 }
mjr 52:63f0a9b45f0c 43
mjr 52:63f0a9b45f0c 44 bool USBHID::sendTO(HID_REPORT *report, int timeout_ms)
mjr 52:63f0a9b45f0c 45 {
mjr 52:63f0a9b45f0c 46 return writeTO(EPINT_IN, report->data, report->length, MAX_HID_REPORT_SIZE, timeout_ms);
mjr 52:63f0a9b45f0c 47 }
mjr 52:63f0a9b45f0c 48
mjr 52:63f0a9b45f0c 49
mjr 52:63f0a9b45f0c 50 bool USBHID::read(HID_REPORT *report)
mjr 52:63f0a9b45f0c 51 {
mjr 52:63f0a9b45f0c 52 uint32_t bytesRead = 0;
mjr 52:63f0a9b45f0c 53 bool result;
mjr 52:63f0a9b45f0c 54 result = USBDevice::readEP(EPINT_OUT, report->data, &bytesRead, MAX_HID_REPORT_SIZE);
mjr 52:63f0a9b45f0c 55 if(!readStart(EPINT_OUT, MAX_HID_REPORT_SIZE))
mjr 52:63f0a9b45f0c 56 return false;
mjr 52:63f0a9b45f0c 57 report->length = bytesRead;
mjr 52:63f0a9b45f0c 58 return result;
mjr 52:63f0a9b45f0c 59 }
mjr 52:63f0a9b45f0c 60
mjr 52:63f0a9b45f0c 61
mjr 52:63f0a9b45f0c 62 bool USBHID::readNB(HID_REPORT *report)
mjr 52:63f0a9b45f0c 63 {
mjr 52:63f0a9b45f0c 64 uint32_t bytesRead = 0;
mjr 52:63f0a9b45f0c 65 bool result;
mjr 52:63f0a9b45f0c 66 result = USBDevice::readEP_NB(EPINT_OUT, report->data, &bytesRead, MAX_HID_REPORT_SIZE);
mjr 52:63f0a9b45f0c 67 // if readEP_NB did not succeed, does not issue a readStart
mjr 52:63f0a9b45f0c 68 if (!result)
mjr 52:63f0a9b45f0c 69 return false;
mjr 52:63f0a9b45f0c 70 report->length = bytesRead;
mjr 52:63f0a9b45f0c 71 if(!readStart(EPINT_OUT, MAX_HID_REPORT_SIZE))
mjr 52:63f0a9b45f0c 72 return false;
mjr 52:63f0a9b45f0c 73 return result;
mjr 52:63f0a9b45f0c 74 }
mjr 52:63f0a9b45f0c 75
mjr 52:63f0a9b45f0c 76
mjr 52:63f0a9b45f0c 77 uint16_t USBHID::reportDescLength() {
mjr 52:63f0a9b45f0c 78 reportDesc();
mjr 52:63f0a9b45f0c 79 return reportLength;
mjr 52:63f0a9b45f0c 80 }
mjr 52:63f0a9b45f0c 81
mjr 52:63f0a9b45f0c 82
mjr 52:63f0a9b45f0c 83
mjr 52:63f0a9b45f0c 84 //
mjr 52:63f0a9b45f0c 85 // Route callbacks from lower layers to class(es)
mjr 52:63f0a9b45f0c 86 //
mjr 52:63f0a9b45f0c 87
mjr 52:63f0a9b45f0c 88
mjr 52:63f0a9b45f0c 89 // Called in ISR context
mjr 52:63f0a9b45f0c 90 // Called by USBDevice on Endpoint0 request
mjr 52:63f0a9b45f0c 91 // This is used to handle extensions to standard requests
mjr 52:63f0a9b45f0c 92 // and class specific requests
mjr 52:63f0a9b45f0c 93 // Return true if class handles this request
mjr 52:63f0a9b45f0c 94 bool USBHID::USBCallback_request() {
mjr 52:63f0a9b45f0c 95 bool success = false;
mjr 52:63f0a9b45f0c 96 CONTROL_TRANSFER * transfer = getTransferPtr();
mjr 52:63f0a9b45f0c 97 uint8_t *hidDescriptor;
mjr 52:63f0a9b45f0c 98
mjr 52:63f0a9b45f0c 99 // Process additional standard requests
mjr 52:63f0a9b45f0c 100
mjr 52:63f0a9b45f0c 101 if ((transfer->setup.bmRequestType.Type == STANDARD_TYPE))
mjr 52:63f0a9b45f0c 102 {
mjr 52:63f0a9b45f0c 103 switch (transfer->setup.bRequest)
mjr 52:63f0a9b45f0c 104 {
mjr 52:63f0a9b45f0c 105 case GET_DESCRIPTOR:
mjr 52:63f0a9b45f0c 106 switch (DESCRIPTOR_TYPE(transfer->setup.wValue))
mjr 52:63f0a9b45f0c 107 {
mjr 52:63f0a9b45f0c 108 case REPORT_DESCRIPTOR:
mjr 52:63f0a9b45f0c 109 if ((reportDesc() != NULL) && (reportDescLength() != 0))
mjr 52:63f0a9b45f0c 110 {
mjr 52:63f0a9b45f0c 111 // Get the interface index. In cases where one device exposes
mjr 52:63f0a9b45f0c 112 // multiple interfaces, this is used to identify which interface
mjr 52:63f0a9b45f0c 113 // is being queried. The base mbed implementation ignores this,
mjr 52:63f0a9b45f0c 114 // which makes it impossible to implement multiple interfaces.
mjr 52:63f0a9b45f0c 115 int idx = DESCRIPTOR_INDEX(transfer->setup.wValue);
mjr 52:63f0a9b45f0c 116 transfer->remaining = reportDescLengthN(idx);
mjr 52:63f0a9b45f0c 117 transfer->ptr = reportDescN(idx);
mjr 52:63f0a9b45f0c 118 transfer->direction = DEVICE_TO_HOST;
mjr 52:63f0a9b45f0c 119 success = true;
mjr 52:63f0a9b45f0c 120 }
mjr 52:63f0a9b45f0c 121 break;
mjr 52:63f0a9b45f0c 122
mjr 52:63f0a9b45f0c 123 case HID_DESCRIPTOR:
mjr 52:63f0a9b45f0c 124 {
mjr 52:63f0a9b45f0c 125 // Find the HID descriptor, after the configuration descriptor
mjr 52:63f0a9b45f0c 126 int idx = DESCRIPTOR_INDEX(transfer->setup.wValue);
mjr 52:63f0a9b45f0c 127 hidDescriptor = findDescriptor(HID_DESCRIPTOR, idx);
mjr 52:63f0a9b45f0c 128 if (hidDescriptor != NULL)
mjr 52:63f0a9b45f0c 129 {
mjr 52:63f0a9b45f0c 130 transfer->remaining = HID_DESCRIPTOR_LENGTH;
mjr 52:63f0a9b45f0c 131 transfer->ptr = hidDescriptor;
mjr 52:63f0a9b45f0c 132 transfer->direction = DEVICE_TO_HOST;
mjr 52:63f0a9b45f0c 133 success = true;
mjr 52:63f0a9b45f0c 134 }
mjr 52:63f0a9b45f0c 135 }
mjr 52:63f0a9b45f0c 136 break;
mjr 52:63f0a9b45f0c 137
mjr 52:63f0a9b45f0c 138 default:
mjr 52:63f0a9b45f0c 139 break;
mjr 52:63f0a9b45f0c 140 }
mjr 52:63f0a9b45f0c 141 break;
mjr 52:63f0a9b45f0c 142 default:
mjr 52:63f0a9b45f0c 143 break;
mjr 52:63f0a9b45f0c 144 }
mjr 52:63f0a9b45f0c 145 }
mjr 52:63f0a9b45f0c 146
mjr 52:63f0a9b45f0c 147 // Process class-specific requests
mjr 52:63f0a9b45f0c 148
mjr 52:63f0a9b45f0c 149 if (transfer->setup.bmRequestType.Type == CLASS_TYPE)
mjr 52:63f0a9b45f0c 150 {
mjr 52:63f0a9b45f0c 151 switch (transfer->setup.bRequest)
mjr 52:63f0a9b45f0c 152 {
mjr 52:63f0a9b45f0c 153 case GET_REPORT:
mjr 52:63f0a9b45f0c 154 // not implemented
mjr 52:63f0a9b45f0c 155 break;
mjr 52:63f0a9b45f0c 156
mjr 52:63f0a9b45f0c 157 case GET_IDLE:
mjr 52:63f0a9b45f0c 158 #if 0 // $$$
mjr 52:63f0a9b45f0c 159 // retrieve the idle rate from an interface
mjr 52:63f0a9b45f0c 160 idleData = getIdleTime(transfer->setup.wIndex, LSB(transfer->setup.wValue));
mjr 52:63f0a9b45f0c 161 transfer->ptr = &idleData;
mjr 52:63f0a9b45f0c 162 transfer->remaining = 1;
mjr 52:63f0a9b45f0c 163 transfer->direction = DEVICE_TO_HOST;
mjr 52:63f0a9b45f0c 164 success = true;
mjr 52:63f0a9b45f0c 165 #endif // $$$
mjr 52:63f0a9b45f0c 166 break;
mjr 52:63f0a9b45f0c 167
mjr 52:63f0a9b45f0c 168 case GET_PROTOCOL:
mjr 52:63f0a9b45f0c 169 // not implemented
mjr 52:63f0a9b45f0c 170 break;
mjr 52:63f0a9b45f0c 171
mjr 52:63f0a9b45f0c 172 case SET_REPORT:
mjr 52:63f0a9b45f0c 173 // First byte will be used for report ID
mjr 52:63f0a9b45f0c 174 outputReport.data[0] = transfer->setup.wValue & 0xff;
mjr 52:63f0a9b45f0c 175 outputReport.length = transfer->setup.wLength + 1;
mjr 52:63f0a9b45f0c 176
mjr 52:63f0a9b45f0c 177 transfer->remaining = sizeof(outputReport.data) - 1;
mjr 52:63f0a9b45f0c 178 transfer->ptr = &outputReport.data[1];
mjr 52:63f0a9b45f0c 179 transfer->direction = HOST_TO_DEVICE;
mjr 52:63f0a9b45f0c 180 transfer->notify = true;
mjr 52:63f0a9b45f0c 181 success = true;
mjr 52:63f0a9b45f0c 182
mjr 52:63f0a9b45f0c 183 case SET_IDLE:
mjr 52:63f0a9b45f0c 184 #if 0 // $$$
mjr 52:63f0a9b45f0c 185 // Set idle time - time between INTERRUPT IN reports from the
mjr 52:63f0a9b45f0c 186 // device when there are no changes to report. setup.wIndex
mjr 52:63f0a9b45f0c 187 // is the interface index (we're setting the idle time for the
mjr 52:63f0a9b45f0c 188 // given interface only). MSB(setup.wValue) gives the interval
mjr 52:63f0a9b45f0c 189 // in 4ms units, with the special case that 0 means infinity.
mjr 52:63f0a9b45f0c 190 setIdleTime(transfer->setup.wIndex, LSB(transfer->setup.wValue), MSB(transfer->setup.wValue));
mjr 52:63f0a9b45f0c 191 transfer->remaining = 0;
mjr 52:63f0a9b45f0c 192 transfer->direction = DEVICE_TO_HOST;
mjr 52:63f0a9b45f0c 193 success = true;
mjr 52:63f0a9b45f0c 194 #endif // $$$
mjr 52:63f0a9b45f0c 195 break;
mjr 52:63f0a9b45f0c 196
mjr 52:63f0a9b45f0c 197 case SET_PROTOCOL:
mjr 52:63f0a9b45f0c 198 // not implemented
mjr 52:63f0a9b45f0c 199 break;
mjr 52:63f0a9b45f0c 200
mjr 52:63f0a9b45f0c 201 default:
mjr 52:63f0a9b45f0c 202 break;
mjr 52:63f0a9b45f0c 203 }
mjr 52:63f0a9b45f0c 204 }
mjr 52:63f0a9b45f0c 205
mjr 52:63f0a9b45f0c 206 return success;
mjr 52:63f0a9b45f0c 207 }
mjr 52:63f0a9b45f0c 208
mjr 52:63f0a9b45f0c 209
mjr 52:63f0a9b45f0c 210 #define DEFAULT_CONFIGURATION (1)
mjr 52:63f0a9b45f0c 211
mjr 52:63f0a9b45f0c 212
mjr 52:63f0a9b45f0c 213 // Called in ISR context
mjr 52:63f0a9b45f0c 214 // Set configuration. Return false if the
mjr 52:63f0a9b45f0c 215 // configuration is not supported
mjr 52:63f0a9b45f0c 216 bool USBHID::USBCallback_setConfiguration(uint8_t configuration) {
mjr 52:63f0a9b45f0c 217 if (configuration != DEFAULT_CONFIGURATION) {
mjr 52:63f0a9b45f0c 218 return false;
mjr 52:63f0a9b45f0c 219 }
mjr 52:63f0a9b45f0c 220
mjr 52:63f0a9b45f0c 221 // Configure endpoints > 0
mjr 52:63f0a9b45f0c 222 addEndpoint(EPINT_IN, MAX_PACKET_SIZE_EPINT);
mjr 52:63f0a9b45f0c 223 addEndpoint(EPINT_OUT, MAX_PACKET_SIZE_EPINT);
mjr 52:63f0a9b45f0c 224
mjr 52:63f0a9b45f0c 225 // We activate the endpoint to be able to recceive data
mjr 52:63f0a9b45f0c 226 readStart(EPINT_OUT, MAX_PACKET_SIZE_EPINT);
mjr 52:63f0a9b45f0c 227 return true;
mjr 52:63f0a9b45f0c 228 }
mjr 52:63f0a9b45f0c 229
mjr 52:63f0a9b45f0c 230
mjr 52:63f0a9b45f0c 231 uint8_t * USBHID::stringIinterfaceDesc() {
mjr 52:63f0a9b45f0c 232 static uint8_t stringIinterfaceDescriptor[] = {
mjr 52:63f0a9b45f0c 233 0x08, //bLength
mjr 52:63f0a9b45f0c 234 STRING_DESCRIPTOR, //bDescriptorType 0x03
mjr 52:63f0a9b45f0c 235 'H',0,'I',0,'D',0, //bString iInterface - HID
mjr 52:63f0a9b45f0c 236 };
mjr 52:63f0a9b45f0c 237 return stringIinterfaceDescriptor;
mjr 52:63f0a9b45f0c 238 }
mjr 52:63f0a9b45f0c 239
mjr 52:63f0a9b45f0c 240 uint8_t * USBHID::stringIproductDesc() {
mjr 52:63f0a9b45f0c 241 static uint8_t stringIproductDescriptor[] = {
mjr 52:63f0a9b45f0c 242 0x16, //bLength
mjr 52:63f0a9b45f0c 243 STRING_DESCRIPTOR, //bDescriptorType 0x03
mjr 52:63f0a9b45f0c 244 'H',0,'I',0,'D',0,' ',0,'D',0,'E',0,'V',0,'I',0,'C',0,'E',0 //bString iProduct - HID device
mjr 52:63f0a9b45f0c 245 };
mjr 52:63f0a9b45f0c 246 return stringIproductDescriptor;
mjr 52:63f0a9b45f0c 247 }
mjr 52:63f0a9b45f0c 248
mjr 52:63f0a9b45f0c 249
mjr 52:63f0a9b45f0c 250
mjr 52:63f0a9b45f0c 251 uint8_t * USBHID::reportDesc() {
mjr 52:63f0a9b45f0c 252 static uint8_t reportDescriptor[] = {
mjr 52:63f0a9b45f0c 253 0x06, LSB(0xFFAB), MSB(0xFFAB),
mjr 52:63f0a9b45f0c 254 0x0A, LSB(0x0200), MSB(0x0200),
mjr 52:63f0a9b45f0c 255 0xA1, 0x01, // Collection 0x01
mjr 52:63f0a9b45f0c 256 0x75, 0x08, // report size = 8 bits
mjr 52:63f0a9b45f0c 257 0x15, 0x00, // logical minimum = 0
mjr 52:63f0a9b45f0c 258 0x26, 0xFF, 0x00, // logical maximum = 255
mjr 52:63f0a9b45f0c 259 0x95, input_length, // report count
mjr 52:63f0a9b45f0c 260 0x09, 0x01, // usage
mjr 52:63f0a9b45f0c 261 0x81, 0x02, // Input (array)
mjr 52:63f0a9b45f0c 262 0x95, output_length,// report count
mjr 52:63f0a9b45f0c 263 0x09, 0x02, // usage
mjr 52:63f0a9b45f0c 264 0x91, 0x02, // Output (array)
mjr 52:63f0a9b45f0c 265 0xC0 // end collection
mjr 52:63f0a9b45f0c 266
mjr 52:63f0a9b45f0c 267 };
mjr 52:63f0a9b45f0c 268 reportLength = sizeof(reportDescriptor);
mjr 52:63f0a9b45f0c 269 return reportDescriptor;
mjr 52:63f0a9b45f0c 270 }
mjr 52:63f0a9b45f0c 271
mjr 52:63f0a9b45f0c 272 #define DEFAULT_CONFIGURATION (1)
mjr 52:63f0a9b45f0c 273 #define TOTAL_DESCRIPTOR_LENGTH ((1 * CONFIGURATION_DESCRIPTOR_LENGTH) \
mjr 52:63f0a9b45f0c 274 + (1 * INTERFACE_DESCRIPTOR_LENGTH) \
mjr 52:63f0a9b45f0c 275 + (1 * HID_DESCRIPTOR_LENGTH) \
mjr 52:63f0a9b45f0c 276 + (2 * ENDPOINT_DESCRIPTOR_LENGTH))
mjr 52:63f0a9b45f0c 277
mjr 52:63f0a9b45f0c 278 uint8_t * USBHID::configurationDesc() {
mjr 52:63f0a9b45f0c 279 static uint8_t configurationDescriptor[] = {
mjr 52:63f0a9b45f0c 280 CONFIGURATION_DESCRIPTOR_LENGTH,// bLength
mjr 52:63f0a9b45f0c 281 CONFIGURATION_DESCRIPTOR, // bDescriptorType
mjr 52:63f0a9b45f0c 282 LSB(TOTAL_DESCRIPTOR_LENGTH), // wTotalLength (LSB)
mjr 52:63f0a9b45f0c 283 MSB(TOTAL_DESCRIPTOR_LENGTH), // wTotalLength (MSB)
mjr 52:63f0a9b45f0c 284 0x01, // bNumInterfaces
mjr 52:63f0a9b45f0c 285 DEFAULT_CONFIGURATION, // bConfigurationValue
mjr 52:63f0a9b45f0c 286 0x00, // iConfiguration
mjr 52:63f0a9b45f0c 287 C_RESERVED | C_SELF_POWERED, // bmAttributes
mjr 52:63f0a9b45f0c 288 C_POWER(0), // bMaxPower
mjr 52:63f0a9b45f0c 289
mjr 52:63f0a9b45f0c 290 INTERFACE_DESCRIPTOR_LENGTH, // bLength
mjr 52:63f0a9b45f0c 291 INTERFACE_DESCRIPTOR, // bDescriptorType
mjr 52:63f0a9b45f0c 292 0x00, // bInterfaceNumber
mjr 52:63f0a9b45f0c 293 0x00, // bAlternateSetting
mjr 52:63f0a9b45f0c 294 0x02, // bNumEndpoints
mjr 52:63f0a9b45f0c 295 HID_CLASS, // bInterfaceClass
mjr 52:63f0a9b45f0c 296 HID_SUBCLASS_NONE, // bInterfaceSubClass
mjr 52:63f0a9b45f0c 297 HID_PROTOCOL_NONE, // bInterfaceProtocol
mjr 52:63f0a9b45f0c 298 0x00, // iInterface
mjr 52:63f0a9b45f0c 299
mjr 52:63f0a9b45f0c 300 HID_DESCRIPTOR_LENGTH, // bLength
mjr 52:63f0a9b45f0c 301 HID_DESCRIPTOR, // bDescriptorType
mjr 52:63f0a9b45f0c 302 LSB(HID_VERSION_1_11), // bcdHID (LSB)
mjr 52:63f0a9b45f0c 303 MSB(HID_VERSION_1_11), // bcdHID (MSB)
mjr 52:63f0a9b45f0c 304 0x00, // bCountryCode
mjr 52:63f0a9b45f0c 305 0x01, // bNumDescriptors
mjr 52:63f0a9b45f0c 306 REPORT_DESCRIPTOR, // bDescriptorType
mjr 52:63f0a9b45f0c 307 (uint8_t)(LSB(this->reportDescLength())), // wDescriptorLength (LSB)
mjr 52:63f0a9b45f0c 308 (uint8_t)(MSB(this->reportDescLength())), // wDescriptorLength (MSB)
mjr 52:63f0a9b45f0c 309
mjr 52:63f0a9b45f0c 310 ENDPOINT_DESCRIPTOR_LENGTH, // bLength
mjr 52:63f0a9b45f0c 311 ENDPOINT_DESCRIPTOR, // bDescriptorType
mjr 52:63f0a9b45f0c 312 PHY_TO_DESC(EPINT_IN), // bEndpointAddress
mjr 52:63f0a9b45f0c 313 E_INTERRUPT, // bmAttributes
mjr 52:63f0a9b45f0c 314 LSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (LSB)
mjr 52:63f0a9b45f0c 315 MSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (MSB)
mjr 52:63f0a9b45f0c 316 1, // bInterval (milliseconds)
mjr 52:63f0a9b45f0c 317
mjr 52:63f0a9b45f0c 318 ENDPOINT_DESCRIPTOR_LENGTH, // bLength
mjr 52:63f0a9b45f0c 319 ENDPOINT_DESCRIPTOR, // bDescriptorType
mjr 52:63f0a9b45f0c 320 PHY_TO_DESC(EPINT_OUT), // bEndpointAddress
mjr 52:63f0a9b45f0c 321 E_INTERRUPT, // bmAttributes
mjr 52:63f0a9b45f0c 322 LSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (LSB)
mjr 52:63f0a9b45f0c 323 MSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (MSB)
mjr 52:63f0a9b45f0c 324 1, // bInterval (milliseconds)
mjr 52:63f0a9b45f0c 325 };
mjr 52:63f0a9b45f0c 326 return configurationDescriptor;
mjr 52:63f0a9b45f0c 327 }