USBAudio example using a microphone

Dependencies:   USBDevice mbed

Committer:
samux
Date:
Tue Dec 20 10:44:10 2011 +0000
Revision:
5:b49b6a8ca111
Parent:
0:539ec61e1fbb
Child:
6:be128039be16
doesn\'t work but cleaning up...

Who changed what in which revision?

UserRevisionLine numberNew contents of line
samux 0:539ec61e1fbb 1 /* Copyright (c) 2010-2011 mbed.org, MIT License
samux 0:539ec61e1fbb 2 *
samux 0:539ec61e1fbb 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
samux 0:539ec61e1fbb 4 * and associated documentation files (the "Software"), to deal in the Software without
samux 0:539ec61e1fbb 5 * restriction, including without limitation the rights to use, copy, modify, merge, publish,
samux 0:539ec61e1fbb 6 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
samux 0:539ec61e1fbb 7 * Software is furnished to do so, subject to the following conditions:
samux 0:539ec61e1fbb 8 *
samux 0:539ec61e1fbb 9 * The above copyright notice and this permission notice shall be included in all copies or
samux 0:539ec61e1fbb 10 * substantial portions of the Software.
samux 0:539ec61e1fbb 11 *
samux 0:539ec61e1fbb 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
samux 0:539ec61e1fbb 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
samux 0:539ec61e1fbb 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
samux 0:539ec61e1fbb 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
samux 0:539ec61e1fbb 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
samux 0:539ec61e1fbb 17 */
samux 0:539ec61e1fbb 18
samux 0:539ec61e1fbb 19 #ifndef USBAUDIO_TYPES_H
samux 0:539ec61e1fbb 20 #define USBAUDIO_TYPES_H
samux 0:539ec61e1fbb 21
samux 0:539ec61e1fbb 22
samux 0:539ec61e1fbb 23 #define DEFAULT_CONFIGURATION (1)
samux 0:539ec61e1fbb 24
samux 0:539ec61e1fbb 25
samux 0:539ec61e1fbb 26 // Audio Descriptor Sizes
samux 0:539ec61e1fbb 27 #define CONTROL_INTERFACE_DESCRIPTOR_LENGTH 0x09
samux 0:539ec61e1fbb 28 #define STREAMING_INTERFACE_DESCRIPTOR_LENGTH 0x07
samux 0:539ec61e1fbb 29 #define INPUT_TERMINAL_DESCRIPTOR_LENGTH 0x0C
samux 0:539ec61e1fbb 30 #define OUTPUT_TERMINAL_DESCRIPTOR_LENGTH 0x09
samux 0:539ec61e1fbb 31 #define FEATURE_UNIT_DESCRIPTOR_LENGTH 0x09
samux 0:539ec61e1fbb 32 #define STREAMING_ENDPOINT_DESCRIPTOR_LENGTH 0x07
samux 0:539ec61e1fbb 33
samux 0:539ec61e1fbb 34 // Audio Format Type Descriptor Sizes
samux 0:539ec61e1fbb 35 #define FORMAT_TYPE_I_DESCRIPTOR_LENGTH 0x0b
samux 0:539ec61e1fbb 36
samux 0:539ec61e1fbb 37 #define AUDIO_CLASS 0x01
samux 0:539ec61e1fbb 38 #define SUBCLASS_AUDIOCONTROL 0x01
samux 0:539ec61e1fbb 39 #define SUBCLASS_AUDIOSTREAMING 0x02
samux 0:539ec61e1fbb 40
samux 0:539ec61e1fbb 41 // Audio Descriptor Types
samux 0:539ec61e1fbb 42 #define INTERFACE_DESCRIPTOR_TYPE 0x24
samux 0:539ec61e1fbb 43 #define ENDPOINT_DESCRIPTOR_TYPE 0x25
samux 0:539ec61e1fbb 44
samux 0:539ec61e1fbb 45 // Audio Control Interface Descriptor Subtypes
samux 0:539ec61e1fbb 46 #define CONTROL_HEADER 0x01
samux 0:539ec61e1fbb 47 #define CONTROL_INPUT_TERMINAL 0x02
samux 0:539ec61e1fbb 48 #define CONTROL_OUTPUT_TERMINAL 0x03
samux 0:539ec61e1fbb 49 #define CONTROL_SELECTOR_UNIT 0x05
samux 0:539ec61e1fbb 50 #define CONTROL_FEATURE_UNIT 0x06
samux 0:539ec61e1fbb 51
samux 0:539ec61e1fbb 52 // USB Terminal Types
samux 0:539ec61e1fbb 53 #define TERMINAL_USB_STREAMING 0x0101
samux 0:539ec61e1fbb 54
samux 0:539ec61e1fbb 55 // Predefined Audio Channel Configuration Bits
samux 0:539ec61e1fbb 56 // Mono
samux 0:539ec61e1fbb 57 #define CHANNEL_M 0x0000
samux 0:539ec61e1fbb 58 #define CHANNEL_L 0x0001 /* Left Front */
samux 0:539ec61e1fbb 59 #define CHANNEL_R 0x0002 /* Right Front */
samux 0:539ec61e1fbb 60
samux 0:539ec61e1fbb 61 // Feature Unit Control Bits
samux 0:539ec61e1fbb 62 #define CONTROL_MUTE 0x0001
samux 0:539ec61e1fbb 63 #define CONTROL_VOLUME 0x0002
samux 0:539ec61e1fbb 64
samux 0:539ec61e1fbb 65
samux 0:539ec61e1fbb 66 /* Input Terminal Types */
samux 0:539ec61e1fbb 67 #define TERMINAL_MICROPHONE 0x0201
samux 0:539ec61e1fbb 68
samux 0:539ec61e1fbb 69 // Output Terminal Types
samux 0:539ec61e1fbb 70 #define TERMINAL_SPEAKER 0x0301
samux 0:539ec61e1fbb 71 #define TERMINAL_HEADPHONES 0x0302
samux 0:539ec61e1fbb 72
samux 0:539ec61e1fbb 73 // Audio Streaming Interface Descriptor Subtypes
samux 0:539ec61e1fbb 74 #define STREAMING_GENERAL 0x01
samux 0:539ec61e1fbb 75 #define STREAMING_FORMAT_TYPE 0x02
samux 0:539ec61e1fbb 76
samux 0:539ec61e1fbb 77 // Audio Data Format Type I Codes
samux 0:539ec61e1fbb 78 #define FORMAT_PCM 0x0001
samux 0:539ec61e1fbb 79
samux 0:539ec61e1fbb 80 // Audio Format Types
samux 0:539ec61e1fbb 81 #define FORMAT_TYPE_I 0x01
samux 0:539ec61e1fbb 82
samux 0:539ec61e1fbb 83 // Audio Endpoint Descriptor Subtypes
samux 0:539ec61e1fbb 84 #define ENDPOINT_GENERAL 0x01
samux 0:539ec61e1fbb 85
samux 0:539ec61e1fbb 86 #endif