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:
Mon Feb 15 23:03:55 2016 +0000
Revision:
68:edfecf67a931
Parent:
52:63f0a9b45f0c
Finalize USB library updates to fix compatibility problems introduced in USBHAL_KL25Z overhaul.

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 "USBAudio.h"
mjr 52:63f0a9b45f0c 21 #include "USBAudio_Types.h"
mjr 52:63f0a9b45f0c 22
mjr 52:63f0a9b45f0c 23
mjr 52:63f0a9b45f0c 24
mjr 52:63f0a9b45f0c 25 USBAudio::USBAudio(uint32_t frequency_in, uint8_t channel_nb_in, uint32_t frequency_out, uint8_t channel_nb_out, uint16_t vendor_id, uint16_t product_id, uint16_t product_release): USBDevice(vendor_id, product_id, product_release) {
mjr 52:63f0a9b45f0c 26 mute = 0;
mjr 52:63f0a9b45f0c 27 volCur = 0x0080;
mjr 52:63f0a9b45f0c 28 volMin = 0x0000;
mjr 52:63f0a9b45f0c 29 volMax = 0x0100;
mjr 52:63f0a9b45f0c 30 volRes = 0x0004;
mjr 52:63f0a9b45f0c 31 available = false;
mjr 52:63f0a9b45f0c 32
mjr 52:63f0a9b45f0c 33 FREQ_IN = frequency_in;
mjr 52:63f0a9b45f0c 34 FREQ_OUT = frequency_out;
mjr 52:63f0a9b45f0c 35
mjr 52:63f0a9b45f0c 36 this->channel_nb_in = channel_nb_in;
mjr 52:63f0a9b45f0c 37 this->channel_nb_out = channel_nb_out;
mjr 52:63f0a9b45f0c 38
mjr 52:63f0a9b45f0c 39 // stereo -> *2, mono -> *1
mjr 52:63f0a9b45f0c 40 PACKET_SIZE_ISO_IN = (FREQ_IN / 500) * channel_nb_in;
mjr 52:63f0a9b45f0c 41 PACKET_SIZE_ISO_OUT = (FREQ_OUT / 500) * channel_nb_out;
mjr 52:63f0a9b45f0c 42
mjr 52:63f0a9b45f0c 43 // STEREO -> left and right
mjr 52:63f0a9b45f0c 44 channel_config_in = (channel_nb_in == 1) ? CHANNEL_M : CHANNEL_L + CHANNEL_R;
mjr 52:63f0a9b45f0c 45 channel_config_out = (channel_nb_out == 1) ? CHANNEL_M : CHANNEL_L + CHANNEL_R;
mjr 52:63f0a9b45f0c 46
mjr 52:63f0a9b45f0c 47 SOF_handler = false;
mjr 52:63f0a9b45f0c 48
mjr 52:63f0a9b45f0c 49 buf_stream_out = NULL;
mjr 52:63f0a9b45f0c 50 buf_stream_in = NULL;
mjr 52:63f0a9b45f0c 51
mjr 52:63f0a9b45f0c 52 interruptOUT = false;
mjr 52:63f0a9b45f0c 53 writeIN = false;
mjr 52:63f0a9b45f0c 54 interruptIN = false;
mjr 52:63f0a9b45f0c 55 available = false;
mjr 52:63f0a9b45f0c 56
mjr 52:63f0a9b45f0c 57 volume = 0;
mjr 52:63f0a9b45f0c 58
mjr 52:63f0a9b45f0c 59 // connect the device
mjr 52:63f0a9b45f0c 60 USBDevice::connect();
mjr 52:63f0a9b45f0c 61 }
mjr 52:63f0a9b45f0c 62
mjr 52:63f0a9b45f0c 63 bool USBAudio::read(uint8_t * buf) {
mjr 52:63f0a9b45f0c 64 buf_stream_in = buf;
mjr 52:63f0a9b45f0c 65 SOF_handler = false;
mjr 52:63f0a9b45f0c 66 while (!available || !SOF_handler);
mjr 52:63f0a9b45f0c 67 available = false;
mjr 52:63f0a9b45f0c 68 return true;
mjr 52:63f0a9b45f0c 69 }
mjr 52:63f0a9b45f0c 70
mjr 52:63f0a9b45f0c 71 bool USBAudio::readNB(uint8_t * buf) {
mjr 52:63f0a9b45f0c 72 buf_stream_in = buf;
mjr 52:63f0a9b45f0c 73 SOF_handler = false;
mjr 52:63f0a9b45f0c 74 while (!SOF_handler);
mjr 52:63f0a9b45f0c 75 if (available) {
mjr 52:63f0a9b45f0c 76 available = false;
mjr 52:63f0a9b45f0c 77 buf_stream_in = NULL;
mjr 52:63f0a9b45f0c 78 return true;
mjr 52:63f0a9b45f0c 79 }
mjr 52:63f0a9b45f0c 80 return false;
mjr 52:63f0a9b45f0c 81 }
mjr 52:63f0a9b45f0c 82
mjr 52:63f0a9b45f0c 83 bool USBAudio::readWrite(uint8_t * buf_read, uint8_t * buf_write) {
mjr 52:63f0a9b45f0c 84 buf_stream_in = buf_read;
mjr 52:63f0a9b45f0c 85 SOF_handler = false;
mjr 52:63f0a9b45f0c 86 writeIN = false;
mjr 52:63f0a9b45f0c 87 if (interruptIN) {
mjr 52:63f0a9b45f0c 88 USBDevice::writeNB(EP3IN, buf_write, PACKET_SIZE_ISO_OUT, PACKET_SIZE_ISO_OUT);
mjr 52:63f0a9b45f0c 89 } else {
mjr 52:63f0a9b45f0c 90 buf_stream_out = buf_write;
mjr 52:63f0a9b45f0c 91 }
mjr 52:63f0a9b45f0c 92 while (!available);
mjr 52:63f0a9b45f0c 93 if (interruptIN) {
mjr 52:63f0a9b45f0c 94 while (!writeIN);
mjr 52:63f0a9b45f0c 95 }
mjr 52:63f0a9b45f0c 96 while (!SOF_handler);
mjr 52:63f0a9b45f0c 97 return true;
mjr 52:63f0a9b45f0c 98 }
mjr 52:63f0a9b45f0c 99
mjr 52:63f0a9b45f0c 100
mjr 52:63f0a9b45f0c 101 bool USBAudio::write(uint8_t * buf) {
mjr 52:63f0a9b45f0c 102 writeIN = false;
mjr 52:63f0a9b45f0c 103 SOF_handler = false;
mjr 52:63f0a9b45f0c 104 if (interruptIN) {
mjr 52:63f0a9b45f0c 105 USBDevice::writeNB(EP3IN, buf, PACKET_SIZE_ISO_OUT, PACKET_SIZE_ISO_OUT);
mjr 52:63f0a9b45f0c 106 } else {
mjr 52:63f0a9b45f0c 107 buf_stream_out = buf;
mjr 52:63f0a9b45f0c 108 }
mjr 52:63f0a9b45f0c 109 while (!SOF_handler);
mjr 52:63f0a9b45f0c 110 if (interruptIN) {
mjr 52:63f0a9b45f0c 111 while (!writeIN);
mjr 52:63f0a9b45f0c 112 }
mjr 52:63f0a9b45f0c 113 return true;
mjr 52:63f0a9b45f0c 114 }
mjr 52:63f0a9b45f0c 115
mjr 52:63f0a9b45f0c 116
mjr 52:63f0a9b45f0c 117 float USBAudio::getVolume() {
mjr 52:63f0a9b45f0c 118 return (mute) ? 0.0 : volume;
mjr 52:63f0a9b45f0c 119 }
mjr 52:63f0a9b45f0c 120
mjr 52:63f0a9b45f0c 121
mjr 52:63f0a9b45f0c 122 bool USBAudio::EP3_OUT_callback() {
mjr 52:63f0a9b45f0c 123 uint32_t size = 0;
mjr 52:63f0a9b45f0c 124 interruptOUT = true;
mjr 52:63f0a9b45f0c 125 if (buf_stream_in != NULL) {
mjr 52:63f0a9b45f0c 126 readEP(EP3OUT, (uint8_t *)buf_stream_in, &size, PACKET_SIZE_ISO_IN);
mjr 52:63f0a9b45f0c 127 available = true;
mjr 52:63f0a9b45f0c 128 buf_stream_in = NULL;
mjr 52:63f0a9b45f0c 129 }
mjr 52:63f0a9b45f0c 130 readStart(EP3OUT, PACKET_SIZE_ISO_IN);
mjr 52:63f0a9b45f0c 131 return false;
mjr 52:63f0a9b45f0c 132 }
mjr 52:63f0a9b45f0c 133
mjr 52:63f0a9b45f0c 134
mjr 52:63f0a9b45f0c 135 bool USBAudio::EP3_IN_callback() {
mjr 52:63f0a9b45f0c 136 interruptIN = true;
mjr 52:63f0a9b45f0c 137 writeIN = true;
mjr 52:63f0a9b45f0c 138 return true;
mjr 52:63f0a9b45f0c 139 }
mjr 52:63f0a9b45f0c 140
mjr 52:63f0a9b45f0c 141
mjr 52:63f0a9b45f0c 142
mjr 52:63f0a9b45f0c 143 // Called in ISR context on each start of frame
mjr 52:63f0a9b45f0c 144 void USBAudio::SOF(int frameNumber) {
mjr 52:63f0a9b45f0c 145 uint32_t size = 0;
mjr 52:63f0a9b45f0c 146
mjr 52:63f0a9b45f0c 147 if (!interruptOUT) {
mjr 52:63f0a9b45f0c 148 // read the isochronous endpoint
mjr 52:63f0a9b45f0c 149 if (buf_stream_in != NULL) {
mjr 52:63f0a9b45f0c 150 if (USBDevice::readEP_NB(EP3OUT, (uint8_t *)buf_stream_in, &size, PACKET_SIZE_ISO_IN)) {
mjr 52:63f0a9b45f0c 151 if (size) {
mjr 52:63f0a9b45f0c 152 available = true;
mjr 52:63f0a9b45f0c 153 readStart(EP3OUT, PACKET_SIZE_ISO_IN);
mjr 52:63f0a9b45f0c 154 buf_stream_in = NULL;
mjr 52:63f0a9b45f0c 155 }
mjr 52:63f0a9b45f0c 156 }
mjr 52:63f0a9b45f0c 157 }
mjr 52:63f0a9b45f0c 158 }
mjr 52:63f0a9b45f0c 159
mjr 52:63f0a9b45f0c 160 if (!interruptIN) {
mjr 52:63f0a9b45f0c 161 // write if needed
mjr 52:63f0a9b45f0c 162 if (buf_stream_out != NULL) {
mjr 52:63f0a9b45f0c 163 USBDevice::writeNB(EP3IN, (uint8_t *)buf_stream_out, PACKET_SIZE_ISO_OUT, PACKET_SIZE_ISO_OUT);
mjr 52:63f0a9b45f0c 164 buf_stream_out = NULL;
mjr 52:63f0a9b45f0c 165 }
mjr 52:63f0a9b45f0c 166 }
mjr 52:63f0a9b45f0c 167
mjr 52:63f0a9b45f0c 168 SOF_handler = true;
mjr 52:63f0a9b45f0c 169 }
mjr 52:63f0a9b45f0c 170
mjr 52:63f0a9b45f0c 171
mjr 52:63f0a9b45f0c 172 // Called in ISR context
mjr 52:63f0a9b45f0c 173 // Set configuration. Return false if the configuration is not supported.
mjr 52:63f0a9b45f0c 174 bool USBAudio::USBCallback_setConfiguration(uint8_t configuration) {
mjr 52:63f0a9b45f0c 175 if (configuration != DEFAULT_CONFIGURATION) {
mjr 52:63f0a9b45f0c 176 return false;
mjr 52:63f0a9b45f0c 177 }
mjr 52:63f0a9b45f0c 178
mjr 52:63f0a9b45f0c 179 // Configure isochronous endpoint
mjr 52:63f0a9b45f0c 180 realiseEndpoint(EP3OUT, PACKET_SIZE_ISO_IN, ISOCHRONOUS);
mjr 52:63f0a9b45f0c 181 realiseEndpoint(EP3IN, PACKET_SIZE_ISO_OUT, ISOCHRONOUS);
mjr 52:63f0a9b45f0c 182
mjr 52:63f0a9b45f0c 183 // activate readings on this endpoint
mjr 52:63f0a9b45f0c 184 readStart(EP3OUT, PACKET_SIZE_ISO_IN);
mjr 52:63f0a9b45f0c 185 return true;
mjr 52:63f0a9b45f0c 186 }
mjr 52:63f0a9b45f0c 187
mjr 52:63f0a9b45f0c 188
mjr 52:63f0a9b45f0c 189 // Called in ISR context
mjr 52:63f0a9b45f0c 190 // Set alternate setting. Return false if the alternate setting is not supported
mjr 52:63f0a9b45f0c 191 bool USBAudio::USBCallback_setInterface(uint16_t interface, uint8_t alternate) {
mjr 52:63f0a9b45f0c 192 if (interface == 0 && alternate == 0) {
mjr 52:63f0a9b45f0c 193 return true;
mjr 52:63f0a9b45f0c 194 }
mjr 52:63f0a9b45f0c 195 if (interface == 1 && (alternate == 0 || alternate == 1)) {
mjr 52:63f0a9b45f0c 196 return true;
mjr 52:63f0a9b45f0c 197 }
mjr 52:63f0a9b45f0c 198 if (interface == 2 && (alternate == 0 || alternate == 1)) {
mjr 52:63f0a9b45f0c 199 return true;
mjr 52:63f0a9b45f0c 200 }
mjr 52:63f0a9b45f0c 201 return false;
mjr 52:63f0a9b45f0c 202 }
mjr 52:63f0a9b45f0c 203
mjr 52:63f0a9b45f0c 204
mjr 52:63f0a9b45f0c 205
mjr 52:63f0a9b45f0c 206 // Called in ISR context
mjr 52:63f0a9b45f0c 207 // Called by USBDevice on Endpoint0 request
mjr 52:63f0a9b45f0c 208 // This is used to handle extensions to standard requests and class specific requests.
mjr 52:63f0a9b45f0c 209 // Return true if class handles this request
mjr 52:63f0a9b45f0c 210 bool USBAudio::USBCallback_request() {
mjr 52:63f0a9b45f0c 211 bool success = false;
mjr 52:63f0a9b45f0c 212 CONTROL_TRANSFER * transfer = getTransferPtr();
mjr 52:63f0a9b45f0c 213
mjr 52:63f0a9b45f0c 214 // Process class-specific requests
mjr 52:63f0a9b45f0c 215 if (transfer->setup.bmRequestType.Type == CLASS_TYPE) {
mjr 52:63f0a9b45f0c 216
mjr 52:63f0a9b45f0c 217 // Feature Unit: Interface = 0, ID = 2
mjr 52:63f0a9b45f0c 218 if (transfer->setup.wIndex == 0x0200) {
mjr 52:63f0a9b45f0c 219
mjr 52:63f0a9b45f0c 220 // Master Channel
mjr 52:63f0a9b45f0c 221 if ((transfer->setup.wValue & 0xff) == 0) {
mjr 52:63f0a9b45f0c 222
mjr 52:63f0a9b45f0c 223 switch (transfer->setup.wValue >> 8) {
mjr 52:63f0a9b45f0c 224 case MUTE_CONTROL:
mjr 52:63f0a9b45f0c 225 switch (transfer->setup.bRequest) {
mjr 52:63f0a9b45f0c 226 case REQUEST_GET_CUR:
mjr 52:63f0a9b45f0c 227 transfer->remaining = 1;
mjr 52:63f0a9b45f0c 228 transfer->ptr = &mute;
mjr 52:63f0a9b45f0c 229 transfer->direction = DEVICE_TO_HOST;
mjr 52:63f0a9b45f0c 230 success = true;
mjr 52:63f0a9b45f0c 231 break;
mjr 52:63f0a9b45f0c 232
mjr 52:63f0a9b45f0c 233 case REQUEST_SET_CUR:
mjr 52:63f0a9b45f0c 234 transfer->remaining = 1;
mjr 52:63f0a9b45f0c 235 transfer->notify = true;
mjr 52:63f0a9b45f0c 236 transfer->direction = HOST_TO_DEVICE;
mjr 52:63f0a9b45f0c 237 success = true;
mjr 52:63f0a9b45f0c 238 break;
mjr 52:63f0a9b45f0c 239 default:
mjr 52:63f0a9b45f0c 240 break;
mjr 52:63f0a9b45f0c 241 }
mjr 52:63f0a9b45f0c 242 break;
mjr 52:63f0a9b45f0c 243 case VOLUME_CONTROL:
mjr 52:63f0a9b45f0c 244 switch (transfer->setup.bRequest) {
mjr 52:63f0a9b45f0c 245 case REQUEST_GET_CUR:
mjr 52:63f0a9b45f0c 246 transfer->remaining = 2;
mjr 52:63f0a9b45f0c 247 transfer->ptr = (uint8_t *)&volCur;
mjr 52:63f0a9b45f0c 248 transfer->direction = DEVICE_TO_HOST;
mjr 52:63f0a9b45f0c 249 success = true;
mjr 52:63f0a9b45f0c 250 break;
mjr 52:63f0a9b45f0c 251 case REQUEST_GET_MIN:
mjr 52:63f0a9b45f0c 252 transfer->remaining = 2;
mjr 52:63f0a9b45f0c 253 transfer->ptr = (uint8_t *)&volMin;
mjr 52:63f0a9b45f0c 254 transfer->direction = DEVICE_TO_HOST;
mjr 52:63f0a9b45f0c 255 success = true;
mjr 52:63f0a9b45f0c 256 break;
mjr 52:63f0a9b45f0c 257 case REQUEST_GET_MAX:
mjr 52:63f0a9b45f0c 258 transfer->remaining = 2;
mjr 52:63f0a9b45f0c 259 transfer->ptr = (uint8_t *)&volMax;
mjr 52:63f0a9b45f0c 260 transfer->direction = DEVICE_TO_HOST;
mjr 52:63f0a9b45f0c 261 success = true;
mjr 52:63f0a9b45f0c 262 break;
mjr 52:63f0a9b45f0c 263 case REQUEST_GET_RES:
mjr 52:63f0a9b45f0c 264 transfer->remaining = 2;
mjr 52:63f0a9b45f0c 265 transfer->ptr = (uint8_t *)&volRes;
mjr 52:63f0a9b45f0c 266 transfer->direction = DEVICE_TO_HOST;
mjr 52:63f0a9b45f0c 267 success = true;
mjr 52:63f0a9b45f0c 268 break;
mjr 52:63f0a9b45f0c 269
mjr 52:63f0a9b45f0c 270 case REQUEST_SET_CUR:
mjr 52:63f0a9b45f0c 271 transfer->remaining = 2;
mjr 52:63f0a9b45f0c 272 transfer->notify = true;
mjr 52:63f0a9b45f0c 273 transfer->direction = HOST_TO_DEVICE;
mjr 52:63f0a9b45f0c 274 success = true;
mjr 52:63f0a9b45f0c 275 break;
mjr 52:63f0a9b45f0c 276 case REQUEST_SET_MIN:
mjr 52:63f0a9b45f0c 277 transfer->remaining = 2;
mjr 52:63f0a9b45f0c 278 transfer->notify = true;
mjr 52:63f0a9b45f0c 279 transfer->direction = HOST_TO_DEVICE;
mjr 52:63f0a9b45f0c 280 success = true;
mjr 52:63f0a9b45f0c 281 break;
mjr 52:63f0a9b45f0c 282 case REQUEST_SET_MAX:
mjr 52:63f0a9b45f0c 283 transfer->remaining = 2;
mjr 52:63f0a9b45f0c 284 transfer->notify = true;
mjr 52:63f0a9b45f0c 285 transfer->direction = HOST_TO_DEVICE;
mjr 52:63f0a9b45f0c 286 success = true;
mjr 52:63f0a9b45f0c 287 break;
mjr 52:63f0a9b45f0c 288 case REQUEST_SET_RES:
mjr 52:63f0a9b45f0c 289 transfer->remaining = 2;
mjr 52:63f0a9b45f0c 290 transfer->notify = true;
mjr 52:63f0a9b45f0c 291 transfer->direction = HOST_TO_DEVICE;
mjr 52:63f0a9b45f0c 292 success = true;
mjr 52:63f0a9b45f0c 293 break;
mjr 52:63f0a9b45f0c 294 }
mjr 52:63f0a9b45f0c 295 break;
mjr 52:63f0a9b45f0c 296 default:
mjr 52:63f0a9b45f0c 297 break;
mjr 52:63f0a9b45f0c 298 }
mjr 52:63f0a9b45f0c 299 }
mjr 52:63f0a9b45f0c 300 }
mjr 52:63f0a9b45f0c 301 }
mjr 52:63f0a9b45f0c 302 return success;
mjr 52:63f0a9b45f0c 303 }
mjr 52:63f0a9b45f0c 304
mjr 52:63f0a9b45f0c 305
mjr 52:63f0a9b45f0c 306 // Called in ISR context when a data OUT stage has been performed
mjr 52:63f0a9b45f0c 307 void USBAudio::USBCallback_requestCompleted(uint8_t * buf, uint32_t length) {
mjr 52:63f0a9b45f0c 308 if ((length == 1) || (length == 2)) {
mjr 52:63f0a9b45f0c 309 uint16_t data = (length == 1) ? *buf : *((uint16_t *)buf);
mjr 52:63f0a9b45f0c 310 CONTROL_TRANSFER * transfer = getTransferPtr();
mjr 52:63f0a9b45f0c 311 switch (transfer->setup.wValue >> 8) {
mjr 52:63f0a9b45f0c 312 case MUTE_CONTROL:
mjr 52:63f0a9b45f0c 313 switch (transfer->setup.bRequest) {
mjr 52:63f0a9b45f0c 314 case REQUEST_SET_CUR:
mjr 52:63f0a9b45f0c 315 mute = data & 0xff;
mjr 52:63f0a9b45f0c 316 updateVol.call();
mjr 52:63f0a9b45f0c 317 break;
mjr 52:63f0a9b45f0c 318 default:
mjr 52:63f0a9b45f0c 319 break;
mjr 52:63f0a9b45f0c 320 }
mjr 52:63f0a9b45f0c 321 break;
mjr 52:63f0a9b45f0c 322 case VOLUME_CONTROL:
mjr 52:63f0a9b45f0c 323 switch (transfer->setup.bRequest) {
mjr 52:63f0a9b45f0c 324 case REQUEST_SET_CUR:
mjr 52:63f0a9b45f0c 325 volCur = data;
mjr 52:63f0a9b45f0c 326 volume = (float)volCur/(float)volMax;
mjr 52:63f0a9b45f0c 327 updateVol.call();
mjr 52:63f0a9b45f0c 328 break;
mjr 52:63f0a9b45f0c 329 default:
mjr 52:63f0a9b45f0c 330 break;
mjr 52:63f0a9b45f0c 331 }
mjr 52:63f0a9b45f0c 332 break;
mjr 52:63f0a9b45f0c 333 default:
mjr 52:63f0a9b45f0c 334 break;
mjr 52:63f0a9b45f0c 335 }
mjr 52:63f0a9b45f0c 336 }
mjr 52:63f0a9b45f0c 337 }
mjr 52:63f0a9b45f0c 338
mjr 52:63f0a9b45f0c 339
mjr 52:63f0a9b45f0c 340
mjr 52:63f0a9b45f0c 341 #define TOTAL_DESCRIPTOR_LENGTH ((1 * CONFIGURATION_DESCRIPTOR_LENGTH) \
mjr 52:63f0a9b45f0c 342 + (5 * INTERFACE_DESCRIPTOR_LENGTH) \
mjr 52:63f0a9b45f0c 343 + (1 * CONTROL_INTERFACE_DESCRIPTOR_LENGTH + 1) \
mjr 52:63f0a9b45f0c 344 + (2 * INPUT_TERMINAL_DESCRIPTOR_LENGTH) \
mjr 52:63f0a9b45f0c 345 + (1 * FEATURE_UNIT_DESCRIPTOR_LENGTH) \
mjr 52:63f0a9b45f0c 346 + (2 * OUTPUT_TERMINAL_DESCRIPTOR_LENGTH) \
mjr 52:63f0a9b45f0c 347 + (2 * STREAMING_INTERFACE_DESCRIPTOR_LENGTH) \
mjr 52:63f0a9b45f0c 348 + (2 * FORMAT_TYPE_I_DESCRIPTOR_LENGTH) \
mjr 52:63f0a9b45f0c 349 + (2 * (ENDPOINT_DESCRIPTOR_LENGTH + 2)) \
mjr 52:63f0a9b45f0c 350 + (2 * STREAMING_ENDPOINT_DESCRIPTOR_LENGTH) )
mjr 52:63f0a9b45f0c 351
mjr 52:63f0a9b45f0c 352 #define TOTAL_CONTROL_INTF_LENGTH (CONTROL_INTERFACE_DESCRIPTOR_LENGTH + 1 + \
mjr 52:63f0a9b45f0c 353 2*INPUT_TERMINAL_DESCRIPTOR_LENGTH + \
mjr 52:63f0a9b45f0c 354 FEATURE_UNIT_DESCRIPTOR_LENGTH + \
mjr 52:63f0a9b45f0c 355 2*OUTPUT_TERMINAL_DESCRIPTOR_LENGTH)
mjr 52:63f0a9b45f0c 356
mjr 52:63f0a9b45f0c 357 uint8_t * USBAudio::configurationDesc() {
mjr 52:63f0a9b45f0c 358 static uint8_t configDescriptor[] = {
mjr 52:63f0a9b45f0c 359 // Configuration 1
mjr 52:63f0a9b45f0c 360 CONFIGURATION_DESCRIPTOR_LENGTH, // bLength
mjr 52:63f0a9b45f0c 361 CONFIGURATION_DESCRIPTOR, // bDescriptorType
mjr 52:63f0a9b45f0c 362 LSB(TOTAL_DESCRIPTOR_LENGTH), // wTotalLength (LSB)
mjr 52:63f0a9b45f0c 363 MSB(TOTAL_DESCRIPTOR_LENGTH), // wTotalLength (MSB)
mjr 52:63f0a9b45f0c 364 0x03, // bNumInterfaces
mjr 52:63f0a9b45f0c 365 DEFAULT_CONFIGURATION, // bConfigurationValue
mjr 52:63f0a9b45f0c 366 0x00, // iConfiguration
mjr 52:63f0a9b45f0c 367 0x80, // bmAttributes
mjr 52:63f0a9b45f0c 368 50, // bMaxPower
mjr 52:63f0a9b45f0c 369
mjr 52:63f0a9b45f0c 370 // Interface 0, Alternate Setting 0, Audio Control
mjr 52:63f0a9b45f0c 371 INTERFACE_DESCRIPTOR_LENGTH, // bLength
mjr 52:63f0a9b45f0c 372 INTERFACE_DESCRIPTOR, // bDescriptorType
mjr 52:63f0a9b45f0c 373 0x00, // bInterfaceNumber
mjr 52:63f0a9b45f0c 374 0x00, // bAlternateSetting
mjr 52:63f0a9b45f0c 375 0x00, // bNumEndpoints
mjr 52:63f0a9b45f0c 376 AUDIO_CLASS, // bInterfaceClass
mjr 52:63f0a9b45f0c 377 SUBCLASS_AUDIOCONTROL, // bInterfaceSubClass
mjr 52:63f0a9b45f0c 378 0x00, // bInterfaceProtocol
mjr 52:63f0a9b45f0c 379 0x00, // iInterface
mjr 52:63f0a9b45f0c 380
mjr 52:63f0a9b45f0c 381
mjr 52:63f0a9b45f0c 382 // Audio Control Interface
mjr 52:63f0a9b45f0c 383 CONTROL_INTERFACE_DESCRIPTOR_LENGTH + 1,// bLength
mjr 52:63f0a9b45f0c 384 INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType
mjr 52:63f0a9b45f0c 385 CONTROL_HEADER, // bDescriptorSubtype
mjr 52:63f0a9b45f0c 386 LSB(0x0100), // bcdADC (LSB)
mjr 52:63f0a9b45f0c 387 MSB(0x0100), // bcdADC (MSB)
mjr 52:63f0a9b45f0c 388 LSB(TOTAL_CONTROL_INTF_LENGTH), // wTotalLength
mjr 52:63f0a9b45f0c 389 MSB(TOTAL_CONTROL_INTF_LENGTH), // wTotalLength
mjr 52:63f0a9b45f0c 390 0x02, // bInCollection
mjr 52:63f0a9b45f0c 391 0x01, // baInterfaceNr
mjr 52:63f0a9b45f0c 392 0x02, // baInterfaceNr
mjr 52:63f0a9b45f0c 393
mjr 52:63f0a9b45f0c 394 // Audio Input Terminal (Speaker)
mjr 52:63f0a9b45f0c 395 INPUT_TERMINAL_DESCRIPTOR_LENGTH, // bLength
mjr 52:63f0a9b45f0c 396 INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType
mjr 52:63f0a9b45f0c 397 CONTROL_INPUT_TERMINAL, // bDescriptorSubtype
mjr 52:63f0a9b45f0c 398 0x01, // bTerminalID
mjr 52:63f0a9b45f0c 399 LSB(TERMINAL_USB_STREAMING), // wTerminalType
mjr 52:63f0a9b45f0c 400 MSB(TERMINAL_USB_STREAMING), // wTerminalType
mjr 52:63f0a9b45f0c 401 0x00, // bAssocTerminal
mjr 52:63f0a9b45f0c 402 channel_nb_in, // bNrChannels
mjr 52:63f0a9b45f0c 403 (uint8_t)(LSB(channel_config_in)), // wChannelConfig
mjr 52:63f0a9b45f0c 404 (uint8_t)(MSB(channel_config_in)), // wChannelConfig
mjr 52:63f0a9b45f0c 405 0x00, // iChannelNames
mjr 52:63f0a9b45f0c 406 0x00, // iTerminal
mjr 52:63f0a9b45f0c 407
mjr 52:63f0a9b45f0c 408 // Audio Feature Unit (Speaker)
mjr 52:63f0a9b45f0c 409 FEATURE_UNIT_DESCRIPTOR_LENGTH, // bLength
mjr 52:63f0a9b45f0c 410 INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType
mjr 52:63f0a9b45f0c 411 CONTROL_FEATURE_UNIT, // bDescriptorSubtype
mjr 52:63f0a9b45f0c 412 0x02, // bUnitID
mjr 52:63f0a9b45f0c 413 0x01, // bSourceID
mjr 52:63f0a9b45f0c 414 0x01, // bControlSize
mjr 52:63f0a9b45f0c 415 CONTROL_MUTE |
mjr 52:63f0a9b45f0c 416 CONTROL_VOLUME, // bmaControls(0)
mjr 52:63f0a9b45f0c 417 0x00, // bmaControls(1)
mjr 52:63f0a9b45f0c 418 0x00, // iTerminal
mjr 52:63f0a9b45f0c 419
mjr 52:63f0a9b45f0c 420 // Audio Output Terminal (Speaker)
mjr 52:63f0a9b45f0c 421 OUTPUT_TERMINAL_DESCRIPTOR_LENGTH, // bLength
mjr 52:63f0a9b45f0c 422 INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType
mjr 52:63f0a9b45f0c 423 CONTROL_OUTPUT_TERMINAL, // bDescriptorSubtype
mjr 52:63f0a9b45f0c 424 0x03, // bTerminalID
mjr 52:63f0a9b45f0c 425 LSB(TERMINAL_SPEAKER), // wTerminalType
mjr 52:63f0a9b45f0c 426 MSB(TERMINAL_SPEAKER), // wTerminalType
mjr 52:63f0a9b45f0c 427 0x00, // bAssocTerminal
mjr 52:63f0a9b45f0c 428 0x02, // bSourceID
mjr 52:63f0a9b45f0c 429 0x00, // iTerminal
mjr 52:63f0a9b45f0c 430
mjr 52:63f0a9b45f0c 431
mjr 52:63f0a9b45f0c 432 // Audio Input Terminal (Microphone)
mjr 52:63f0a9b45f0c 433 INPUT_TERMINAL_DESCRIPTOR_LENGTH, // bLength
mjr 52:63f0a9b45f0c 434 INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType
mjr 52:63f0a9b45f0c 435 CONTROL_INPUT_TERMINAL, // bDescriptorSubtype
mjr 52:63f0a9b45f0c 436 0x04, // bTerminalID
mjr 52:63f0a9b45f0c 437 LSB(TERMINAL_MICROPHONE), // wTerminalType
mjr 52:63f0a9b45f0c 438 MSB(TERMINAL_MICROPHONE), // wTerminalType
mjr 52:63f0a9b45f0c 439 0x00, // bAssocTerminal
mjr 52:63f0a9b45f0c 440 channel_nb_out, // bNrChannels
mjr 52:63f0a9b45f0c 441 (uint8_t)(LSB(channel_config_out)), // wChannelConfig
mjr 52:63f0a9b45f0c 442 (uint8_t)(MSB(channel_config_out)), // wChannelConfig
mjr 52:63f0a9b45f0c 443 0x00, // iChannelNames
mjr 52:63f0a9b45f0c 444 0x00, // iTerminal
mjr 52:63f0a9b45f0c 445
mjr 52:63f0a9b45f0c 446 // Audio Output Terminal (Microphone)
mjr 52:63f0a9b45f0c 447 OUTPUT_TERMINAL_DESCRIPTOR_LENGTH, // bLength
mjr 52:63f0a9b45f0c 448 INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType
mjr 52:63f0a9b45f0c 449 CONTROL_OUTPUT_TERMINAL, // bDescriptorSubtype
mjr 52:63f0a9b45f0c 450 0x05, // bTerminalID
mjr 52:63f0a9b45f0c 451 LSB(TERMINAL_USB_STREAMING), // wTerminalType
mjr 52:63f0a9b45f0c 452 MSB(TERMINAL_USB_STREAMING), // wTerminalType
mjr 52:63f0a9b45f0c 453 0x00, // bAssocTerminal
mjr 52:63f0a9b45f0c 454 0x04, // bSourceID
mjr 52:63f0a9b45f0c 455 0x00, // iTerminal
mjr 52:63f0a9b45f0c 456
mjr 52:63f0a9b45f0c 457
mjr 52:63f0a9b45f0c 458
mjr 52:63f0a9b45f0c 459
mjr 52:63f0a9b45f0c 460
mjr 52:63f0a9b45f0c 461
mjr 52:63f0a9b45f0c 462 // Interface 1, Alternate Setting 0, Audio Streaming - Zero Bandwith
mjr 52:63f0a9b45f0c 463 INTERFACE_DESCRIPTOR_LENGTH, // bLength
mjr 52:63f0a9b45f0c 464 INTERFACE_DESCRIPTOR, // bDescriptorType
mjr 52:63f0a9b45f0c 465 0x01, // bInterfaceNumber
mjr 52:63f0a9b45f0c 466 0x00, // bAlternateSetting
mjr 52:63f0a9b45f0c 467 0x00, // bNumEndpoints
mjr 52:63f0a9b45f0c 468 AUDIO_CLASS, // bInterfaceClass
mjr 52:63f0a9b45f0c 469 SUBCLASS_AUDIOSTREAMING, // bInterfaceSubClass
mjr 52:63f0a9b45f0c 470 0x00, // bInterfaceProtocol
mjr 52:63f0a9b45f0c 471 0x00, // iInterface
mjr 52:63f0a9b45f0c 472
mjr 52:63f0a9b45f0c 473 // Interface 1, Alternate Setting 1, Audio Streaming - Operational
mjr 52:63f0a9b45f0c 474 INTERFACE_DESCRIPTOR_LENGTH, // bLength
mjr 52:63f0a9b45f0c 475 INTERFACE_DESCRIPTOR, // bDescriptorType
mjr 52:63f0a9b45f0c 476 0x01, // bInterfaceNumber
mjr 52:63f0a9b45f0c 477 0x01, // bAlternateSetting
mjr 52:63f0a9b45f0c 478 0x01, // bNumEndpoints
mjr 52:63f0a9b45f0c 479 AUDIO_CLASS, // bInterfaceClass
mjr 52:63f0a9b45f0c 480 SUBCLASS_AUDIOSTREAMING, // bInterfaceSubClass
mjr 52:63f0a9b45f0c 481 0x00, // bInterfaceProtocol
mjr 52:63f0a9b45f0c 482 0x00, // iInterface
mjr 52:63f0a9b45f0c 483
mjr 52:63f0a9b45f0c 484 // Audio Streaming Interface
mjr 52:63f0a9b45f0c 485 STREAMING_INTERFACE_DESCRIPTOR_LENGTH, // bLength
mjr 52:63f0a9b45f0c 486 INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType
mjr 52:63f0a9b45f0c 487 STREAMING_GENERAL, // bDescriptorSubtype
mjr 52:63f0a9b45f0c 488 0x01, // bTerminalLink
mjr 52:63f0a9b45f0c 489 0x00, // bDelay
mjr 52:63f0a9b45f0c 490 LSB(FORMAT_PCM), // wFormatTag
mjr 52:63f0a9b45f0c 491 MSB(FORMAT_PCM), // wFormatTag
mjr 52:63f0a9b45f0c 492
mjr 52:63f0a9b45f0c 493 // Audio Type I Format
mjr 52:63f0a9b45f0c 494 FORMAT_TYPE_I_DESCRIPTOR_LENGTH, // bLength
mjr 52:63f0a9b45f0c 495 INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType
mjr 52:63f0a9b45f0c 496 STREAMING_FORMAT_TYPE, // bDescriptorSubtype
mjr 52:63f0a9b45f0c 497 FORMAT_TYPE_I, // bFormatType
mjr 52:63f0a9b45f0c 498 channel_nb_in, // bNrChannels
mjr 52:63f0a9b45f0c 499 0x02, // bSubFrameSize
mjr 52:63f0a9b45f0c 500 16, // bBitResolution
mjr 52:63f0a9b45f0c 501 0x01, // bSamFreqType
mjr 52:63f0a9b45f0c 502 (uint8_t)(LSB(FREQ_IN)), // tSamFreq
mjr 52:63f0a9b45f0c 503 (uint8_t)((FREQ_IN >> 8) & 0xff), // tSamFreq
mjr 52:63f0a9b45f0c 504 (uint8_t)((FREQ_IN >> 16) & 0xff), // tSamFreq
mjr 52:63f0a9b45f0c 505
mjr 52:63f0a9b45f0c 506 // Endpoint - Standard Descriptor
mjr 52:63f0a9b45f0c 507 ENDPOINT_DESCRIPTOR_LENGTH + 2, // bLength
mjr 52:63f0a9b45f0c 508 ENDPOINT_DESCRIPTOR, // bDescriptorType
mjr 52:63f0a9b45f0c 509 PHY_TO_DESC(EPISO_OUT), // bEndpointAddress
mjr 52:63f0a9b45f0c 510 E_ISOCHRONOUS, // bmAttributes
mjr 52:63f0a9b45f0c 511 (uint8_t)(LSB(PACKET_SIZE_ISO_IN)), // wMaxPacketSize
mjr 52:63f0a9b45f0c 512 (uint8_t)(MSB(PACKET_SIZE_ISO_IN)), // wMaxPacketSize
mjr 52:63f0a9b45f0c 513 0x01, // bInterval
mjr 52:63f0a9b45f0c 514 0x00, // bRefresh
mjr 52:63f0a9b45f0c 515 0x00, // bSynchAddress
mjr 52:63f0a9b45f0c 516
mjr 52:63f0a9b45f0c 517 // Endpoint - Audio Streaming
mjr 52:63f0a9b45f0c 518 STREAMING_ENDPOINT_DESCRIPTOR_LENGTH, // bLength
mjr 52:63f0a9b45f0c 519 ENDPOINT_DESCRIPTOR_TYPE, // bDescriptorType
mjr 52:63f0a9b45f0c 520 ENDPOINT_GENERAL, // bDescriptor
mjr 52:63f0a9b45f0c 521 0x00, // bmAttributes
mjr 52:63f0a9b45f0c 522 0x00, // bLockDelayUnits
mjr 52:63f0a9b45f0c 523 LSB(0x0000), // wLockDelay
mjr 52:63f0a9b45f0c 524 MSB(0x0000), // wLockDelay
mjr 52:63f0a9b45f0c 525
mjr 52:63f0a9b45f0c 526
mjr 52:63f0a9b45f0c 527
mjr 52:63f0a9b45f0c 528
mjr 52:63f0a9b45f0c 529
mjr 52:63f0a9b45f0c 530
mjr 52:63f0a9b45f0c 531
mjr 52:63f0a9b45f0c 532 // Interface 1, Alternate Setting 0, Audio Streaming - Zero Bandwith
mjr 52:63f0a9b45f0c 533 INTERFACE_DESCRIPTOR_LENGTH, // bLength
mjr 52:63f0a9b45f0c 534 INTERFACE_DESCRIPTOR, // bDescriptorType
mjr 52:63f0a9b45f0c 535 0x02, // bInterfaceNumber
mjr 52:63f0a9b45f0c 536 0x00, // bAlternateSetting
mjr 52:63f0a9b45f0c 537 0x00, // bNumEndpoints
mjr 52:63f0a9b45f0c 538 AUDIO_CLASS, // bInterfaceClass
mjr 52:63f0a9b45f0c 539 SUBCLASS_AUDIOSTREAMING, // bInterfaceSubClass
mjr 52:63f0a9b45f0c 540 0x00, // bInterfaceProtocol
mjr 52:63f0a9b45f0c 541 0x00, // iInterface
mjr 52:63f0a9b45f0c 542
mjr 52:63f0a9b45f0c 543 // Interface 1, Alternate Setting 1, Audio Streaming - Operational
mjr 52:63f0a9b45f0c 544 INTERFACE_DESCRIPTOR_LENGTH, // bLength
mjr 52:63f0a9b45f0c 545 INTERFACE_DESCRIPTOR, // bDescriptorType
mjr 52:63f0a9b45f0c 546 0x02, // bInterfaceNumber
mjr 52:63f0a9b45f0c 547 0x01, // bAlternateSetting
mjr 52:63f0a9b45f0c 548 0x01, // bNumEndpoints
mjr 52:63f0a9b45f0c 549 AUDIO_CLASS, // bInterfaceClass
mjr 52:63f0a9b45f0c 550 SUBCLASS_AUDIOSTREAMING, // bInterfaceSubClass
mjr 52:63f0a9b45f0c 551 0x00, // bInterfaceProtocol
mjr 52:63f0a9b45f0c 552 0x00, // iInterface
mjr 52:63f0a9b45f0c 553
mjr 52:63f0a9b45f0c 554 // Audio Streaming Interface
mjr 52:63f0a9b45f0c 555 STREAMING_INTERFACE_DESCRIPTOR_LENGTH, // bLength
mjr 52:63f0a9b45f0c 556 INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType
mjr 52:63f0a9b45f0c 557 SUBCLASS_AUDIOCONTROL, // bDescriptorSubtype
mjr 52:63f0a9b45f0c 558 0x05, // bTerminalLink (output terminal microphone)
mjr 52:63f0a9b45f0c 559 0x01, // bDelay
mjr 52:63f0a9b45f0c 560 0x01, // wFormatTag
mjr 52:63f0a9b45f0c 561 0x00, // wFormatTag
mjr 52:63f0a9b45f0c 562
mjr 52:63f0a9b45f0c 563 // Audio Type I Format
mjr 52:63f0a9b45f0c 564 FORMAT_TYPE_I_DESCRIPTOR_LENGTH, // bLength
mjr 52:63f0a9b45f0c 565 INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType
mjr 52:63f0a9b45f0c 566 SUBCLASS_AUDIOSTREAMING, // bDescriptorSubtype
mjr 52:63f0a9b45f0c 567 FORMAT_TYPE_I, // bFormatType
mjr 52:63f0a9b45f0c 568 channel_nb_out, // bNrChannels
mjr 52:63f0a9b45f0c 569 0x02, // bSubFrameSize
mjr 52:63f0a9b45f0c 570 0x10, // bBitResolution
mjr 52:63f0a9b45f0c 571 0x01, // bSamFreqType
mjr 52:63f0a9b45f0c 572 (uint8_t)(LSB(FREQ_OUT)), // tSamFreq
mjr 52:63f0a9b45f0c 573 (uint8_t)((FREQ_OUT >> 8) & 0xff), // tSamFreq
mjr 52:63f0a9b45f0c 574 (uint8_t)((FREQ_OUT >> 16) & 0xff), // tSamFreq
mjr 52:63f0a9b45f0c 575
mjr 52:63f0a9b45f0c 576 // Endpoint - Standard Descriptor
mjr 52:63f0a9b45f0c 577 ENDPOINT_DESCRIPTOR_LENGTH + 2, // bLength
mjr 52:63f0a9b45f0c 578 ENDPOINT_DESCRIPTOR, // bDescriptorType
mjr 52:63f0a9b45f0c 579 PHY_TO_DESC(EPISO_IN), // bEndpointAddress
mjr 52:63f0a9b45f0c 580 E_ISOCHRONOUS, // bmAttributes
mjr 52:63f0a9b45f0c 581 (uint8_t)(LSB(PACKET_SIZE_ISO_OUT)), // wMaxPacketSize
mjr 52:63f0a9b45f0c 582 (uint8_t)(MSB(PACKET_SIZE_ISO_OUT)), // wMaxPacketSize
mjr 52:63f0a9b45f0c 583 0x01, // bInterval
mjr 52:63f0a9b45f0c 584 0x00, // bRefresh
mjr 52:63f0a9b45f0c 585 0x00, // bSynchAddress
mjr 52:63f0a9b45f0c 586
mjr 52:63f0a9b45f0c 587 // Endpoint - Audio Streaming
mjr 52:63f0a9b45f0c 588 STREAMING_ENDPOINT_DESCRIPTOR_LENGTH, // bLength
mjr 52:63f0a9b45f0c 589 ENDPOINT_DESCRIPTOR_TYPE, // bDescriptorType
mjr 52:63f0a9b45f0c 590 ENDPOINT_GENERAL, // bDescriptor
mjr 52:63f0a9b45f0c 591 0x00, // bmAttributes
mjr 52:63f0a9b45f0c 592 0x00, // bLockDelayUnits
mjr 52:63f0a9b45f0c 593 LSB(0x0000), // wLockDelay
mjr 52:63f0a9b45f0c 594 MSB(0x0000), // wLockDelay
mjr 52:63f0a9b45f0c 595
mjr 52:63f0a9b45f0c 596 // Terminator
mjr 52:63f0a9b45f0c 597 0 // bLength
mjr 52:63f0a9b45f0c 598 };
mjr 52:63f0a9b45f0c 599 return configDescriptor;
mjr 52:63f0a9b45f0c 600 }
mjr 52:63f0a9b45f0c 601
mjr 52:63f0a9b45f0c 602 uint8_t * USBAudio::stringIinterfaceDesc() {
mjr 52:63f0a9b45f0c 603 static uint8_t stringIinterfaceDescriptor[] = {
mjr 52:63f0a9b45f0c 604 0x0c, //bLength
mjr 52:63f0a9b45f0c 605 STRING_DESCRIPTOR, //bDescriptorType 0x03
mjr 52:63f0a9b45f0c 606 'A',0,'u',0,'d',0,'i',0,'o',0 //bString iInterface - Audio
mjr 52:63f0a9b45f0c 607 };
mjr 52:63f0a9b45f0c 608 return stringIinterfaceDescriptor;
mjr 52:63f0a9b45f0c 609 }
mjr 52:63f0a9b45f0c 610
mjr 52:63f0a9b45f0c 611 uint8_t * USBAudio::stringIproductDesc() {
mjr 52:63f0a9b45f0c 612 static uint8_t stringIproductDescriptor[] = {
mjr 52:63f0a9b45f0c 613 0x16, //bLength
mjr 52:63f0a9b45f0c 614 STRING_DESCRIPTOR, //bDescriptorType 0x03
mjr 52:63f0a9b45f0c 615 'M',0,'b',0,'e',0,'d',0,' ',0,'A',0,'u',0,'d',0,'i',0,'o',0 //bString iProduct - Mbed Audio
mjr 52:63f0a9b45f0c 616 };
mjr 52:63f0a9b45f0c 617 return stringIproductDescriptor;
mjr 52:63f0a9b45f0c 618 }