This program operates a pH meter and requires an Excel spreadsheet template available at www.kissinstrments.com
USBDevice/USBHID/USBHID.cpp@0:f6b418db17d2, 2016-07-22 (annotated)
- Committer:
- KISScientific
- Date:
- Fri Jul 22 00:03:25 2016 +0000
- Revision:
- 0:f6b418db17d2
pH-V12 version 1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
KISScientific | 0:f6b418db17d2 | 1 | /* Copyright (c) 2010-2011 mbed.org, MIT License |
KISScientific | 0:f6b418db17d2 | 2 | * |
KISScientific | 0:f6b418db17d2 | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
KISScientific | 0:f6b418db17d2 | 4 | * and associated documentation files (the "Software"), to deal in the Software without |
KISScientific | 0:f6b418db17d2 | 5 | * restriction, including without limitation the rights to use, copy, modify, merge, publish, |
KISScientific | 0:f6b418db17d2 | 6 | * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the |
KISScientific | 0:f6b418db17d2 | 7 | * Software is furnished to do so, subject to the following conditions: |
KISScientific | 0:f6b418db17d2 | 8 | * |
KISScientific | 0:f6b418db17d2 | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
KISScientific | 0:f6b418db17d2 | 10 | * substantial portions of the Software. |
KISScientific | 0:f6b418db17d2 | 11 | * |
KISScientific | 0:f6b418db17d2 | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
KISScientific | 0:f6b418db17d2 | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
KISScientific | 0:f6b418db17d2 | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
KISScientific | 0:f6b418db17d2 | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
KISScientific | 0:f6b418db17d2 | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
KISScientific | 0:f6b418db17d2 | 17 | */ |
KISScientific | 0:f6b418db17d2 | 18 | |
KISScientific | 0:f6b418db17d2 | 19 | #include "stdint.h" |
KISScientific | 0:f6b418db17d2 | 20 | #include "USBHAL.h" |
KISScientific | 0:f6b418db17d2 | 21 | #include "USBHID.h" |
KISScientific | 0:f6b418db17d2 | 22 | |
KISScientific | 0:f6b418db17d2 | 23 | |
KISScientific | 0:f6b418db17d2 | 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) |
KISScientific | 0:f6b418db17d2 | 25 | { |
KISScientific | 0:f6b418db17d2 | 26 | output_length = output_report_length; |
KISScientific | 0:f6b418db17d2 | 27 | input_length = input_report_length; |
KISScientific | 0:f6b418db17d2 | 28 | if(connect) { |
KISScientific | 0:f6b418db17d2 | 29 | USBDevice::connect(); |
KISScientific | 0:f6b418db17d2 | 30 | } |
KISScientific | 0:f6b418db17d2 | 31 | } |
KISScientific | 0:f6b418db17d2 | 32 | |
KISScientific | 0:f6b418db17d2 | 33 | |
KISScientific | 0:f6b418db17d2 | 34 | bool USBHID::send(HID_REPORT *report) |
KISScientific | 0:f6b418db17d2 | 35 | { |
KISScientific | 0:f6b418db17d2 | 36 | return write(EPINT_IN, report->data, report->length, MAX_HID_REPORT_SIZE); |
KISScientific | 0:f6b418db17d2 | 37 | } |
KISScientific | 0:f6b418db17d2 | 38 | |
KISScientific | 0:f6b418db17d2 | 39 | bool USBHID::sendNB(HID_REPORT *report) |
KISScientific | 0:f6b418db17d2 | 40 | { |
KISScientific | 0:f6b418db17d2 | 41 | return writeNB(EPINT_IN, report->data, report->length, MAX_HID_REPORT_SIZE); |
KISScientific | 0:f6b418db17d2 | 42 | } |
KISScientific | 0:f6b418db17d2 | 43 | |
KISScientific | 0:f6b418db17d2 | 44 | |
KISScientific | 0:f6b418db17d2 | 45 | bool USBHID::read(HID_REPORT *report) |
KISScientific | 0:f6b418db17d2 | 46 | { |
KISScientific | 0:f6b418db17d2 | 47 | uint32_t bytesRead = 0; |
KISScientific | 0:f6b418db17d2 | 48 | bool result; |
KISScientific | 0:f6b418db17d2 | 49 | result = USBDevice::readEP(EPINT_OUT, report->data, &bytesRead, MAX_HID_REPORT_SIZE); |
KISScientific | 0:f6b418db17d2 | 50 | if(!readStart(EPINT_OUT, MAX_HID_REPORT_SIZE)) |
KISScientific | 0:f6b418db17d2 | 51 | return false; |
KISScientific | 0:f6b418db17d2 | 52 | report->length = bytesRead; |
KISScientific | 0:f6b418db17d2 | 53 | return result; |
KISScientific | 0:f6b418db17d2 | 54 | } |
KISScientific | 0:f6b418db17d2 | 55 | |
KISScientific | 0:f6b418db17d2 | 56 | |
KISScientific | 0:f6b418db17d2 | 57 | bool USBHID::readNB(HID_REPORT *report) |
KISScientific | 0:f6b418db17d2 | 58 | { |
KISScientific | 0:f6b418db17d2 | 59 | uint32_t bytesRead = 0; |
KISScientific | 0:f6b418db17d2 | 60 | bool result; |
KISScientific | 0:f6b418db17d2 | 61 | result = USBDevice::readEP_NB(EPINT_OUT, report->data, &bytesRead, MAX_HID_REPORT_SIZE); |
KISScientific | 0:f6b418db17d2 | 62 | report->length = bytesRead; |
KISScientific | 0:f6b418db17d2 | 63 | if(!readStart(EPINT_OUT, MAX_HID_REPORT_SIZE)) |
KISScientific | 0:f6b418db17d2 | 64 | return false; |
KISScientific | 0:f6b418db17d2 | 65 | return result; |
KISScientific | 0:f6b418db17d2 | 66 | } |
KISScientific | 0:f6b418db17d2 | 67 | |
KISScientific | 0:f6b418db17d2 | 68 | |
KISScientific | 0:f6b418db17d2 | 69 | uint16_t USBHID::reportDescLength() { |
KISScientific | 0:f6b418db17d2 | 70 | reportDesc(); |
KISScientific | 0:f6b418db17d2 | 71 | return reportLength; |
KISScientific | 0:f6b418db17d2 | 72 | } |
KISScientific | 0:f6b418db17d2 | 73 | |
KISScientific | 0:f6b418db17d2 | 74 | |
KISScientific | 0:f6b418db17d2 | 75 | |
KISScientific | 0:f6b418db17d2 | 76 | // |
KISScientific | 0:f6b418db17d2 | 77 | // Route callbacks from lower layers to class(es) |
KISScientific | 0:f6b418db17d2 | 78 | // |
KISScientific | 0:f6b418db17d2 | 79 | |
KISScientific | 0:f6b418db17d2 | 80 | |
KISScientific | 0:f6b418db17d2 | 81 | // Called in ISR context |
KISScientific | 0:f6b418db17d2 | 82 | // Called by USBDevice on Endpoint0 request |
KISScientific | 0:f6b418db17d2 | 83 | // This is used to handle extensions to standard requests |
KISScientific | 0:f6b418db17d2 | 84 | // and class specific requests |
KISScientific | 0:f6b418db17d2 | 85 | // Return true if class handles this request |
KISScientific | 0:f6b418db17d2 | 86 | bool USBHID::USBCallback_request() { |
KISScientific | 0:f6b418db17d2 | 87 | bool success = false; |
KISScientific | 0:f6b418db17d2 | 88 | CONTROL_TRANSFER * transfer = getTransferPtr(); |
KISScientific | 0:f6b418db17d2 | 89 | uint8_t *hidDescriptor; |
KISScientific | 0:f6b418db17d2 | 90 | |
KISScientific | 0:f6b418db17d2 | 91 | // Process additional standard requests |
KISScientific | 0:f6b418db17d2 | 92 | |
KISScientific | 0:f6b418db17d2 | 93 | if ((transfer->setup.bmRequestType.Type == STANDARD_TYPE)) |
KISScientific | 0:f6b418db17d2 | 94 | { |
KISScientific | 0:f6b418db17d2 | 95 | switch (transfer->setup.bRequest) |
KISScientific | 0:f6b418db17d2 | 96 | { |
KISScientific | 0:f6b418db17d2 | 97 | case GET_DESCRIPTOR: |
KISScientific | 0:f6b418db17d2 | 98 | switch (DESCRIPTOR_TYPE(transfer->setup.wValue)) |
KISScientific | 0:f6b418db17d2 | 99 | { |
KISScientific | 0:f6b418db17d2 | 100 | case REPORT_DESCRIPTOR: |
KISScientific | 0:f6b418db17d2 | 101 | if ((reportDesc() != NULL) \ |
KISScientific | 0:f6b418db17d2 | 102 | && (reportDescLength() != 0)) |
KISScientific | 0:f6b418db17d2 | 103 | { |
KISScientific | 0:f6b418db17d2 | 104 | transfer->remaining = reportDescLength(); |
KISScientific | 0:f6b418db17d2 | 105 | transfer->ptr = reportDesc(); |
KISScientific | 0:f6b418db17d2 | 106 | transfer->direction = DEVICE_TO_HOST; |
KISScientific | 0:f6b418db17d2 | 107 | success = true; |
KISScientific | 0:f6b418db17d2 | 108 | } |
KISScientific | 0:f6b418db17d2 | 109 | break; |
KISScientific | 0:f6b418db17d2 | 110 | case HID_DESCRIPTOR: |
KISScientific | 0:f6b418db17d2 | 111 | // Find the HID descriptor, after the configuration descriptor |
KISScientific | 0:f6b418db17d2 | 112 | hidDescriptor = findDescriptor(HID_DESCRIPTOR); |
KISScientific | 0:f6b418db17d2 | 113 | if (hidDescriptor != NULL) |
KISScientific | 0:f6b418db17d2 | 114 | { |
KISScientific | 0:f6b418db17d2 | 115 | transfer->remaining = HID_DESCRIPTOR_LENGTH; |
KISScientific | 0:f6b418db17d2 | 116 | transfer->ptr = hidDescriptor; |
KISScientific | 0:f6b418db17d2 | 117 | transfer->direction = DEVICE_TO_HOST; |
KISScientific | 0:f6b418db17d2 | 118 | success = true; |
KISScientific | 0:f6b418db17d2 | 119 | } |
KISScientific | 0:f6b418db17d2 | 120 | break; |
KISScientific | 0:f6b418db17d2 | 121 | |
KISScientific | 0:f6b418db17d2 | 122 | default: |
KISScientific | 0:f6b418db17d2 | 123 | break; |
KISScientific | 0:f6b418db17d2 | 124 | } |
KISScientific | 0:f6b418db17d2 | 125 | break; |
KISScientific | 0:f6b418db17d2 | 126 | default: |
KISScientific | 0:f6b418db17d2 | 127 | break; |
KISScientific | 0:f6b418db17d2 | 128 | } |
KISScientific | 0:f6b418db17d2 | 129 | } |
KISScientific | 0:f6b418db17d2 | 130 | |
KISScientific | 0:f6b418db17d2 | 131 | // Process class-specific requests |
KISScientific | 0:f6b418db17d2 | 132 | |
KISScientific | 0:f6b418db17d2 | 133 | if (transfer->setup.bmRequestType.Type == CLASS_TYPE) |
KISScientific | 0:f6b418db17d2 | 134 | { |
KISScientific | 0:f6b418db17d2 | 135 | switch (transfer->setup.bRequest) |
KISScientific | 0:f6b418db17d2 | 136 | { |
KISScientific | 0:f6b418db17d2 | 137 | case SET_REPORT: |
KISScientific | 0:f6b418db17d2 | 138 | // First byte will be used for report ID |
KISScientific | 0:f6b418db17d2 | 139 | outputReport.data[0] = transfer->setup.wValue & 0xff; |
KISScientific | 0:f6b418db17d2 | 140 | outputReport.length = transfer->setup.wLength + 1; |
KISScientific | 0:f6b418db17d2 | 141 | |
KISScientific | 0:f6b418db17d2 | 142 | transfer->remaining = sizeof(outputReport.data) - 1; |
KISScientific | 0:f6b418db17d2 | 143 | transfer->ptr = &outputReport.data[1]; |
KISScientific | 0:f6b418db17d2 | 144 | transfer->direction = HOST_TO_DEVICE; |
KISScientific | 0:f6b418db17d2 | 145 | transfer->notify = true; |
KISScientific | 0:f6b418db17d2 | 146 | success = true; |
KISScientific | 0:f6b418db17d2 | 147 | default: |
KISScientific | 0:f6b418db17d2 | 148 | break; |
KISScientific | 0:f6b418db17d2 | 149 | } |
KISScientific | 0:f6b418db17d2 | 150 | } |
KISScientific | 0:f6b418db17d2 | 151 | |
KISScientific | 0:f6b418db17d2 | 152 | return success; |
KISScientific | 0:f6b418db17d2 | 153 | } |
KISScientific | 0:f6b418db17d2 | 154 | |
KISScientific | 0:f6b418db17d2 | 155 | |
KISScientific | 0:f6b418db17d2 | 156 | #define DEFAULT_CONFIGURATION (1) |
KISScientific | 0:f6b418db17d2 | 157 | |
KISScientific | 0:f6b418db17d2 | 158 | |
KISScientific | 0:f6b418db17d2 | 159 | // Called in ISR context |
KISScientific | 0:f6b418db17d2 | 160 | // Set configuration. Return false if the |
KISScientific | 0:f6b418db17d2 | 161 | // configuration is not supported |
KISScientific | 0:f6b418db17d2 | 162 | bool USBHID::USBCallback_setConfiguration(uint8_t configuration) { |
KISScientific | 0:f6b418db17d2 | 163 | if (configuration != DEFAULT_CONFIGURATION) { |
KISScientific | 0:f6b418db17d2 | 164 | return false; |
KISScientific | 0:f6b418db17d2 | 165 | } |
KISScientific | 0:f6b418db17d2 | 166 | |
KISScientific | 0:f6b418db17d2 | 167 | // Configure endpoints > 0 |
KISScientific | 0:f6b418db17d2 | 168 | addEndpoint(EPINT_IN, MAX_PACKET_SIZE_EPINT); |
KISScientific | 0:f6b418db17d2 | 169 | addEndpoint(EPINT_OUT, MAX_PACKET_SIZE_EPINT); |
KISScientific | 0:f6b418db17d2 | 170 | |
KISScientific | 0:f6b418db17d2 | 171 | // We activate the endpoint to be able to recceive data |
KISScientific | 0:f6b418db17d2 | 172 | readStart(EPINT_OUT, MAX_PACKET_SIZE_EPINT); |
KISScientific | 0:f6b418db17d2 | 173 | return true; |
KISScientific | 0:f6b418db17d2 | 174 | } |
KISScientific | 0:f6b418db17d2 | 175 | |
KISScientific | 0:f6b418db17d2 | 176 | |
KISScientific | 0:f6b418db17d2 | 177 | uint8_t * USBHID::stringIinterfaceDesc() { |
KISScientific | 0:f6b418db17d2 | 178 | static uint8_t stringIinterfaceDescriptor[] = { |
KISScientific | 0:f6b418db17d2 | 179 | 0x08, //bLength |
KISScientific | 0:f6b418db17d2 | 180 | STRING_DESCRIPTOR, //bDescriptorType 0x03 |
KISScientific | 0:f6b418db17d2 | 181 | 'H',0,'I',0,'D',0, //bString iInterface - HID |
KISScientific | 0:f6b418db17d2 | 182 | }; |
KISScientific | 0:f6b418db17d2 | 183 | return stringIinterfaceDescriptor; |
KISScientific | 0:f6b418db17d2 | 184 | } |
KISScientific | 0:f6b418db17d2 | 185 | |
KISScientific | 0:f6b418db17d2 | 186 | uint8_t * USBHID::stringIproductDesc() { |
KISScientific | 0:f6b418db17d2 | 187 | static uint8_t stringIproductDescriptor[] = { |
KISScientific | 0:f6b418db17d2 | 188 | 0x16, //bLength |
KISScientific | 0:f6b418db17d2 | 189 | STRING_DESCRIPTOR, //bDescriptorType 0x03 |
KISScientific | 0:f6b418db17d2 | 190 | 'H',0,'I',0,'D',0,' ',0,'D',0,'E',0,'V',0,'I',0,'C',0,'E',0 //bString iProduct - HID device |
KISScientific | 0:f6b418db17d2 | 191 | }; |
KISScientific | 0:f6b418db17d2 | 192 | return stringIproductDescriptor; |
KISScientific | 0:f6b418db17d2 | 193 | } |
KISScientific | 0:f6b418db17d2 | 194 | |
KISScientific | 0:f6b418db17d2 | 195 | |
KISScientific | 0:f6b418db17d2 | 196 | |
KISScientific | 0:f6b418db17d2 | 197 | uint8_t * USBHID::reportDesc() { |
KISScientific | 0:f6b418db17d2 | 198 | static uint8_t reportDescriptor[] = { |
KISScientific | 0:f6b418db17d2 | 199 | 0x06, LSB(0xFFAB), MSB(0xFFAB), |
KISScientific | 0:f6b418db17d2 | 200 | 0x0A, LSB(0x0200), MSB(0x0200), |
KISScientific | 0:f6b418db17d2 | 201 | 0xA1, 0x01, // Collection 0x01 |
KISScientific | 0:f6b418db17d2 | 202 | 0x75, 0x08, // report size = 8 bits |
KISScientific | 0:f6b418db17d2 | 203 | 0x15, 0x00, // logical minimum = 0 |
KISScientific | 0:f6b418db17d2 | 204 | 0x26, 0xFF, 0x00, // logical maximum = 255 |
KISScientific | 0:f6b418db17d2 | 205 | 0x95, input_length, // report count |
KISScientific | 0:f6b418db17d2 | 206 | 0x09, 0x01, // usage |
KISScientific | 0:f6b418db17d2 | 207 | 0x81, 0x02, // Input (array) |
KISScientific | 0:f6b418db17d2 | 208 | 0x95, output_length, // report count |
KISScientific | 0:f6b418db17d2 | 209 | 0x09, 0x02, // usage |
KISScientific | 0:f6b418db17d2 | 210 | 0x91, 0x02, // Output (array) |
KISScientific | 0:f6b418db17d2 | 211 | 0xC0 // end collection |
KISScientific | 0:f6b418db17d2 | 212 | |
KISScientific | 0:f6b418db17d2 | 213 | }; |
KISScientific | 0:f6b418db17d2 | 214 | reportLength = sizeof(reportDescriptor); |
KISScientific | 0:f6b418db17d2 | 215 | return reportDescriptor; |
KISScientific | 0:f6b418db17d2 | 216 | } |
KISScientific | 0:f6b418db17d2 | 217 | |
KISScientific | 0:f6b418db17d2 | 218 | #define DEFAULT_CONFIGURATION (1) |
KISScientific | 0:f6b418db17d2 | 219 | #define TOTAL_DESCRIPTOR_LENGTH ((1 * CONFIGURATION_DESCRIPTOR_LENGTH) \ |
KISScientific | 0:f6b418db17d2 | 220 | + (1 * INTERFACE_DESCRIPTOR_LENGTH) \ |
KISScientific | 0:f6b418db17d2 | 221 | + (1 * HID_DESCRIPTOR_LENGTH) \ |
KISScientific | 0:f6b418db17d2 | 222 | + (2 * ENDPOINT_DESCRIPTOR_LENGTH)) |
KISScientific | 0:f6b418db17d2 | 223 | |
KISScientific | 0:f6b418db17d2 | 224 | uint8_t * USBHID::configurationDesc() { |
KISScientific | 0:f6b418db17d2 | 225 | static uint8_t configurationDescriptor[] = { |
KISScientific | 0:f6b418db17d2 | 226 | CONFIGURATION_DESCRIPTOR_LENGTH,// bLength |
KISScientific | 0:f6b418db17d2 | 227 | CONFIGURATION_DESCRIPTOR, // bDescriptorType |
KISScientific | 0:f6b418db17d2 | 228 | LSB(TOTAL_DESCRIPTOR_LENGTH), // wTotalLength (LSB) |
KISScientific | 0:f6b418db17d2 | 229 | MSB(TOTAL_DESCRIPTOR_LENGTH), // wTotalLength (MSB) |
KISScientific | 0:f6b418db17d2 | 230 | 0x01, // bNumInterfaces |
KISScientific | 0:f6b418db17d2 | 231 | DEFAULT_CONFIGURATION, // bConfigurationValue |
KISScientific | 0:f6b418db17d2 | 232 | 0x00, // iConfiguration |
KISScientific | 0:f6b418db17d2 | 233 | C_RESERVED | C_SELF_POWERED, // bmAttributes |
KISScientific | 0:f6b418db17d2 | 234 | C_POWER(0), // bMaxPower |
KISScientific | 0:f6b418db17d2 | 235 | |
KISScientific | 0:f6b418db17d2 | 236 | INTERFACE_DESCRIPTOR_LENGTH, // bLength |
KISScientific | 0:f6b418db17d2 | 237 | INTERFACE_DESCRIPTOR, // bDescriptorType |
KISScientific | 0:f6b418db17d2 | 238 | 0x00, // bInterfaceNumber |
KISScientific | 0:f6b418db17d2 | 239 | 0x00, // bAlternateSetting |
KISScientific | 0:f6b418db17d2 | 240 | 0x02, // bNumEndpoints |
KISScientific | 0:f6b418db17d2 | 241 | HID_CLASS, // bInterfaceClass |
KISScientific | 0:f6b418db17d2 | 242 | HID_SUBCLASS_NONE, // bInterfaceSubClass |
KISScientific | 0:f6b418db17d2 | 243 | HID_PROTOCOL_NONE, // bInterfaceProtocol |
KISScientific | 0:f6b418db17d2 | 244 | 0x00, // iInterface |
KISScientific | 0:f6b418db17d2 | 245 | |
KISScientific | 0:f6b418db17d2 | 246 | HID_DESCRIPTOR_LENGTH, // bLength |
KISScientific | 0:f6b418db17d2 | 247 | HID_DESCRIPTOR, // bDescriptorType |
KISScientific | 0:f6b418db17d2 | 248 | LSB(HID_VERSION_1_11), // bcdHID (LSB) |
KISScientific | 0:f6b418db17d2 | 249 | MSB(HID_VERSION_1_11), // bcdHID (MSB) |
KISScientific | 0:f6b418db17d2 | 250 | 0x00, // bCountryCode |
KISScientific | 0:f6b418db17d2 | 251 | 0x01, // bNumDescriptors |
KISScientific | 0:f6b418db17d2 | 252 | REPORT_DESCRIPTOR, // bDescriptorType |
KISScientific | 0:f6b418db17d2 | 253 | LSB(this->reportDescLength()), // wDescriptorLength (LSB) |
KISScientific | 0:f6b418db17d2 | 254 | MSB(this->reportDescLength()), // wDescriptorLength (MSB) |
KISScientific | 0:f6b418db17d2 | 255 | |
KISScientific | 0:f6b418db17d2 | 256 | ENDPOINT_DESCRIPTOR_LENGTH, // bLength |
KISScientific | 0:f6b418db17d2 | 257 | ENDPOINT_DESCRIPTOR, // bDescriptorType |
KISScientific | 0:f6b418db17d2 | 258 | PHY_TO_DESC(EPINT_IN), // bEndpointAddress |
KISScientific | 0:f6b418db17d2 | 259 | E_INTERRUPT, // bmAttributes |
KISScientific | 0:f6b418db17d2 | 260 | LSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (LSB) |
KISScientific | 0:f6b418db17d2 | 261 | MSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (MSB) |
KISScientific | 0:f6b418db17d2 | 262 | 1, // bInterval (milliseconds) |
KISScientific | 0:f6b418db17d2 | 263 | |
KISScientific | 0:f6b418db17d2 | 264 | ENDPOINT_DESCRIPTOR_LENGTH, // bLength |
KISScientific | 0:f6b418db17d2 | 265 | ENDPOINT_DESCRIPTOR, // bDescriptorType |
KISScientific | 0:f6b418db17d2 | 266 | PHY_TO_DESC(EPINT_OUT), // bEndpointAddress |
KISScientific | 0:f6b418db17d2 | 267 | E_INTERRUPT, // bmAttributes |
KISScientific | 0:f6b418db17d2 | 268 | LSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (LSB) |
KISScientific | 0:f6b418db17d2 | 269 | MSB(MAX_PACKET_SIZE_EPINT), // wMaxPacketSize (MSB) |
KISScientific | 0:f6b418db17d2 | 270 | 1, // bInterval (milliseconds) |
KISScientific | 0:f6b418db17d2 | 271 | }; |
KISScientific | 0:f6b418db17d2 | 272 | return configurationDescriptor; |
KISScientific | 0:f6b418db17d2 | 273 | } |