USBAudio example using a microphone

Dependencies:   USBDevice mbed

Files at this revision

API Documentation at this revision

Comitter:
samux
Date:
Fri Dec 16 17:12:56 2011 +0000
Parent:
1:1d38d9ca354d
Child:
3:e6a29c83ac52
Commit message:
indent all descr...

Changed in this revision

USBDevice/USBAudio/USBAudio.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/USBDevice/USBAudio/USBAudio.cpp	Fri Dec 16 17:06:49 2011 +0000
+++ b/USBDevice/USBAudio/USBAudio.cpp	Fri Dec 16 17:12:56 2011 +0000
@@ -168,64 +168,63 @@
 uint8_t * USBAudio::configurationDesc() {
     static uint8_t configDescriptor[] = {
         // Configuration 1
-        CONFIGURATION_DESCRIPTOR_LENGTH,        // bLength
-        CONFIGURATION_DESCRIPTOR,               // bDescriptorType
-        0x64,           // wTotalLength (LSB)
-        0x00,           // wTotalLength (MSB)
-        0x02,                                   // bNumInterfaces
-        DEFAULT_CONFIGURATION,                  // bConfigurationValue
-        0x00,                                   // iConfiguration
-        0x80,                                   // bmAttributes
-        50,                                     // bMaxPower
+        CONFIGURATION_DESCRIPTOR_LENGTH,    // bLength
+        CONFIGURATION_DESCRIPTOR,           // bDescriptorType
+        0x64,   // wTotalLength (LSB)
+        0x00,   // wTotalLength (MSB)
+        0x02,   // bNumInterfaces
+        DEFAULT_CONFIGURATION,  // bConfigurationValue
+        0x00,   // iConfiguration
+        0x80,   // bmAttributes
+        50,     // bMaxPower
 
         // Interface 0, Alternate Setting 0, Audio Control
-        INTERFACE_DESCRIPTOR_LENGTH,            // bLength
-        INTERFACE_DESCRIPTOR,                   // bDescriptorType
-        0x00,                                   // bInterfaceNumber
-        0x00,                                   // bAlternateSetting
-        0x00,                                   // bNumEndpoints
-        0x01,                            // bInterfaceClass
-        0x01,                  // bInterfaceSubClass
-        0x00,                                   // bInterfaceProtocol
-        0x00,                                   // iInterface
+        INTERFACE_DESCRIPTOR_LENGTH,    // bLength
+        INTERFACE_DESCRIPTOR,           // bDescriptorType
+        0x00,   // bInterfaceNumber
+        0x00,   // bAlternateSetting
+        0x00,   // bNumEndpoints
+        0x01,   // bInterfaceClass
+        0x01,   // bInterfaceSubClass
+        0x00,   // bInterfaceProtocol
+        0x00,   // iInterface
 
 
         // Audio Control Interface
-        0x09,    // bLength
-        0x24,              // bDescriptorType
-        0x01,                         // bDescriptorSubtype
-        LSB(0x0100),                            // bcdADC (LSB)
-        MSB(0x0100),                            // bcdADC (MSB)
-        0x1e,         // wTotalLength
-        0x00,         // wTotalLength
-        0x01,                                   // bInCollection
-        0x01,                                   // baInterfaceNr
+        0x09,   // bLength
+        0x24,   // bDescriptorType
+        0x01,   // bDescriptorSubtype
+        LSB(0x0100),    // bcdADC (LSB)
+        MSB(0x0100),    // bcdADC (MSB)
+        0x1e,   // wTotalLength
+        0x00,   // wTotalLength
+        0x01,   // bInCollection
+        0x01,   // baInterfaceNr
 
         // Audio Input Terminal (Speaker)
-        0x0c,       // bLength
-        0x24,              // bDescriptorType
-        0x02,                 // bDescriptorSubtype
-        0x01,                                   // bTerminalID
-        0x01,            // wTerminalType
-        0x02,            // wTerminalType
-        0x00,                                   // bAssocTerminal
-        0x01,                             // bNrChannels
-        0x00,                    // wChannelConfig
-        0x00,                    // wChannelConfig
-        0x00,                                   // iChannelNames
-        0x00,                                   // iTerminal
+        0x0c,   // bLength
+        0x24,   // bDescriptorType
+        0x02,   // bDescriptorSubtype
+        0x01,   // bTerminalID
+        0x01,   // wTerminalType
+        0x02,   // wTerminalType
+        0x00,   // bAssocTerminal
+        0x01,   // bNrChannels
+        0x00,   // wChannelConfig
+        0x00,   // wChannelConfig
+        0x00,   // iChannelNames
+        0x00,   // iTerminal
 
         // Audio Output Terminal (Speaker)
-        0x09,      // bLength
-        0x24,              // bDescriptorType
-        0x03,                // bDescriptorSubtype
-        0x02,                                   // bTerminalID
-        0x01,                  // wTerminalType
-        0x01,                  // wTerminalType
-        0x00,                                   // bAssocTerminal
-        0x01,                                   // bSourceID
-        0x00,                                   // iTerminal
-
+        0x09,   // bLength
+        0x24,   // bDescriptorType
+        0x03,   // bDescriptorSubtype
+        0x02,   // bTerminalID
+        0x01,   // wTerminalType
+        0x01,   // wTerminalType
+        0x00,   // bAssocTerminal
+        0x01,   // bSourceID
+        0x00,   // iTerminal
 
 
 
@@ -235,68 +234,68 @@
 
 
         // Interface 1, Alternate Setting 0, Audio Streaming - Zero Bandwith
-        0x09,            // bLength
-        0x04,                   // bDescriptorType
-        0x01,                                   // bInterfaceNumber
-        0x00,                                   // bAlternateSetting
-        0x00,                                   // bNumEndpoints
-        0x01,                            // bInterfaceClass
-        0x02,                // bInterfaceSubClass
-        0x00,                                   // bInterfaceProtocol
-        0x00,                                   // iInterface
+        0x09,   // bLength
+        0x04,   // bDescriptorType
+        0x01,   // bInterfaceNumber
+        0x00,   // bAlternateSetting
+        0x00,   // bNumEndpoints
+        0x01,   // bInterfaceClass
+        0x02,   // bInterfaceSubClass
+        0x00,   // bInterfaceProtocol
+        0x00,   // iInterface
 
         // Interface 1, Alternate Setting 1, Audio Streaming - Operational
-        0x09,            // bLength
-        0x04,                   // bDescriptorType
-        0x01,                                   // bInterfaceNumber
-        0x01,                                   // bAlternateSetting
-        0x01,                                   // bNumEndpoints
-        0x01,                            // bInterfaceClass
-        0x02,                // bInterfaceSubClass
-        0x00,                                   // bInterfaceProtocol
-        0x00,                                   // iInterface
+        0x09,   // bLength
+        0x04,   // bDescriptorType
+        0x01,   // bInterfaceNumber
+        0x01,   // bAlternateSetting
+        0x01,   // bNumEndpoints
+        0x01,   // bInterfaceClass
+        0x02,   // bInterfaceSubClass
+        0x00,   // bInterfaceProtocol
+        0x00,   // iInterface
 
         // Audio Streaming Interface
-        0x07,  // bLength
-        0x24,              // bDescriptorType
-        0x01,                      // bDescriptorSubtype
-        0x02,                                   // bTerminalLink
-        0x01,                                   // bDelay
-        0x01,                        // wFormatTag
-        0x00,                        // wFormatTag
+        0x07,   // bLength
+        0x24,   // bDescriptorType
+        0x01,   // bDescriptorSubtype
+        0x02,   // bTerminalLink
+        0x01,   // bDelay
+        0x01,   // wFormatTag
+        0x00,   // wFormatTag
 
         // Audio Type I Format
-        0x0B,        // bLength
-        0x24,              // bDescriptorType
-        0x02,                  // bDescriptorSubtype
-        0x01,                          // bFormatType
-        0x01,                             // bNrChannels
-        0x02,                                   // bSubFrameSize
-        0x10,                                     // bBitResolution
-        0x01,                                   // bSamFreqType
-        0x40,                              // tSamFreq
-        0x1F,                     // tSamFreq
-        0x00,                    // tSamFreq
+        0x0B,   // bLength
+        0x24,   // bDescriptorType
+        0x02,   // bDescriptorSubtype
+        0x01,   // bFormatType
+        0x01,   // bNrChannels
+        0x02,   // bSubFrameSize
+        0x10,   // bBitResolution
+        0x01,   // bSamFreqType
+        0x40,   // tSamFreq
+        0x1F,   // tSamFreq
+        0x00,   // tSamFreq
 
         // Endpoint - Standard Descriptor
-        0x09,         // bLength
-        0x05,                    // bDescriptorType
-        PHY_TO_DESC(EPISO_IN),                 // bEndpointAddress
-        E_ISOCHRONOUS,                          // bmAttributes
-        LSB(PACKET_SIZE_ISO),                   // wMaxPacketSize
-        MSB(PACKET_SIZE_ISO),                   // wMaxPacketSize
-        0x01,                                   // bInterval
-        0x00,                                   // bRefresh
-        0x00,                                   // bSynchAddress
+        0x09,   // bLength
+        0x05,   // bDescriptorType
+        PHY_TO_DESC(EPISO_IN),  // bEndpointAddress
+        E_ISOCHRONOUS,          // bmAttributes
+        LSB(PACKET_SIZE_ISO),   // wMaxPacketSize
+        MSB(PACKET_SIZE_ISO),   // wMaxPacketSize
+        0x01,   // bInterval
+        0x00,   // bRefresh
+        0x00,   // bSynchAddress
 
         // Endpoint - Audio Streaming
         0x07,   // bLength
-        0x25,               // bDescriptorType
-        0x01,                       // bDescriptor
-        0x00,                                   // bmAttributes
-        0x00,                                   // bLockDelayUnits
-        LSB(0x0000),                            // wLockDelay
-        MSB(0x0000),                            // wLockDelay
+        0x25,   // bDescriptorType
+        0x01,   // bDescriptor
+        0x00,   // bmAttributes
+        0x00,   // bLockDelayUnits
+        LSB(0x0000),    // wLockDelay
+        MSB(0x0000),    // wLockDelay