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