From 359fbfe14d00ab378f85a36664820ea9ba538c3f Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Thu, 10 May 2012 19:24:58 +0000 Subject: Add branch for the conversion of demos to use standard C header files for configuration, rather than makefile defined macros. --- Demos/Device/LowLevel/AudioInput/AudioInput.c | 9 ++++----- Demos/Device/LowLevel/AudioInput/Descriptors.c | 2 +- Demos/Device/LowLevel/AudioInput/Descriptors.h | 11 ++++------- 3 files changed, 9 insertions(+), 13 deletions(-) (limited to 'Demos/Device/LowLevel/AudioInput') diff --git a/Demos/Device/LowLevel/AudioInput/AudioInput.c b/Demos/Device/LowLevel/AudioInput/AudioInput.c index 60eeaf64c..eb9c4b57c 100644 --- a/Demos/Device/LowLevel/AudioInput/AudioInput.c +++ b/Demos/Device/LowLevel/AudioInput/AudioInput.c @@ -118,8 +118,7 @@ void EVENT_USB_Device_ConfigurationChanged(void) bool ConfigSuccess = true; /* Setup Audio Stream Endpoint */ - ConfigSuccess &= Endpoint_ConfigureEndpoint(AUDIO_STREAM_EPNUM, EP_TYPE_ISOCHRONOUS, ENDPOINT_DIR_IN, - AUDIO_STREAM_EPSIZE, ENDPOINT_BANK_DOUBLE); + ConfigSuccess &= Endpoint_ConfigureEndpoint(AUDIO_STREAM_EPADDR, EP_TYPE_ISOCHRONOUS, AUDIO_STREAM_EPSIZE, 2); /* Indicate endpoint configuration success or failure */ LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR); @@ -165,7 +164,7 @@ void EVENT_USB_Device_ControlRequest(void) uint8_t EndpointControl = (USB_ControlRequest.wValue >> 8); /* Only handle SET CURRENT requests to the audio endpoint's sample frequency property */ - if ((EndpointAddress == (ENDPOINT_DIR_IN | AUDIO_STREAM_EPNUM)) && (EndpointControl == AUDIO_EPCONTROL_SamplingFreq)) + if ((EndpointAddress == AUDIO_STREAM_EPADDR) && (EndpointControl == AUDIO_EPCONTROL_SamplingFreq)) { uint8_t SampleRate[3]; @@ -190,7 +189,7 @@ void EVENT_USB_Device_ControlRequest(void) uint8_t EndpointControl = (USB_ControlRequest.wValue >> 8); /* Only handle GET CURRENT requests to the audio endpoint's sample frequency property */ - if ((EndpointAddress == (ENDPOINT_DIR_IN | AUDIO_STREAM_EPNUM)) && (EndpointControl == AUDIO_EPCONTROL_SamplingFreq)) + if ((EndpointAddress == AUDIO_STREAM_EPADDR) && (EndpointControl == AUDIO_EPCONTROL_SamplingFreq)) { uint8_t SampleRate[3]; @@ -215,7 +214,7 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK) uint8_t PrevEndpoint = Endpoint_GetCurrentEndpoint(); /* Select the audio stream endpoint */ - Endpoint_SelectEndpoint(AUDIO_STREAM_EPNUM); + Endpoint_SelectEndpoint(AUDIO_STREAM_EPADDR); /* Check if the current endpoint can be written to and that the audio interface is enabled */ if (Endpoint_IsINReady() && StreamingAudioInterfaceSelected) diff --git a/Demos/Device/LowLevel/AudioInput/Descriptors.c b/Demos/Device/LowLevel/AudioInput/Descriptors.c index 0b1652246..ee37affd2 100644 --- a/Demos/Device/LowLevel/AudioInput/Descriptors.c +++ b/Demos/Device/LowLevel/AudioInput/Descriptors.c @@ -220,7 +220,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = { .Header = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint}, - .EndpointAddress = (ENDPOINT_DIR_IN | AUDIO_STREAM_EPNUM), + .EndpointAddress = AUDIO_STREAM_EPADDR, .Attributes = (EP_TYPE_ISOCHRONOUS | ENDPOINT_ATTR_SYNC | ENDPOINT_USAGE_DATA), .EndpointSize = AUDIO_STREAM_EPSIZE, .PollingIntervalMS = 0x01 diff --git a/Demos/Device/LowLevel/AudioInput/Descriptors.h b/Demos/Device/LowLevel/AudioInput/Descriptors.h index ac0a536de..4680294c9 100644 --- a/Demos/Device/LowLevel/AudioInput/Descriptors.h +++ b/Demos/Device/LowLevel/AudioInput/Descriptors.h @@ -42,14 +42,11 @@ #include /* Macros: */ - /** Endpoint number of the Audio isochronous streaming data endpoint. */ - #define AUDIO_STREAM_EPNUM 1 + /** Endpoint address of the Audio isochronous streaming data IN endpoint. */ + #define AUDIO_STREAM_EPADDR (ENDPOINT_DIR_IN | 1) - /** Endpoint size in bytes of the Audio isochronous streaming data endpoint. The Windows audio stack requires - * at least 192 bytes for correct output, thus the smaller 128 byte maximum endpoint size on some of the smaller - * USB AVR models will result in unavoidable distorted output. - */ - #define AUDIO_STREAM_EPSIZE ENDPOINT_MAX_SIZE(AUDIO_STREAM_EPNUM) + /** Endpoint size in bytes of the Audio isochronous streaming data endpoint. */ + #define AUDIO_STREAM_EPSIZE 256 /* Type Defines: */ /** Type define for the device configuration descriptor structure. This must be defined in the -- cgit v1.2.3