Transistor Gijutsu, October 2014, Special Features Chapter 9, Software of the Function Generator トランジスタ技術2014年10月号 特集第9章のソフトウェア わがまま波形発生器のソフトウェア

Dependencies:   USBDevice mbed

Information

tg_201410s8_AD7714 トランジスタ技術 2014年 10月号 第9章のソフトウェア

Program for Section 9 in October. 2014 issue of the Transistor Gijutsu
(Japanese electronics magazine)

概要

このプログラムは、ソフトウエアDDSにより、任意の波形を出力(2ch)します。 特徴は次のとおりです。

  • PWM出力をDAコンバータとして利用します。
  • 周波数や波形、バースト条件などを個別に設定できる独立した出力を2チャネル持っています。
  • 周波数分解能0.023mHz
  • 周波数範囲0.023mHz~10kHz
  • 各チャネルにそれぞれ、波形の先頭で出力されるトリガ出力があります。
  • 出力波形を関数で定義できます。
  • 休止波数、出力波数、を設定することでバースト波形が出力できます。

ファイル

このソフトウエアは、次のファイルから構成されています。

  • DDS.cpp - DDSによる波形発生
  • main.cpp - main()関数

詳細については、10月号の記事および上記ファイル中のコメントを参照してください。

Committer:
Dance
Date:
Fri Aug 29 08:33:17 2014 +0000
Revision:
0:f1ecca559ec3
Transistor Gijutsu, October 2014, Special Features Chapter 9; ????????2014?10??????9????????

Who changed what in which revision?

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