diff options
Diffstat (limited to 'Demos/Device/LowLevel/AudioInput/AudioInput.c')
-rw-r--r-- | Demos/Device/LowLevel/AudioInput/AudioInput.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Demos/Device/LowLevel/AudioInput/AudioInput.c b/Demos/Device/LowLevel/AudioInput/AudioInput.c index d79167660..e00b693f9 100644 --- a/Demos/Device/LowLevel/AudioInput/AudioInput.c +++ b/Demos/Device/LowLevel/AudioInput/AudioInput.c @@ -160,18 +160,18 @@ void EVENT_USB_Device_ControlRequest(void) case AUDIO_REQ_SetCurrent: if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_ENDPOINT)) { - /* Extract out the relevant request information to get the target Endpoint index and control being set */ - uint8_t EndpointIndex = (uint8_t)USB_ControlRequest.wIndex; + /* Extract out the relevant request information to get the target Endpoint address and control being set */ + uint8_t EndpointAddress = (uint8_t)USB_ControlRequest.wIndex; uint8_t EndpointControl = (USB_ControlRequest.wValue >> 8); /* Only handle SET CURRENT requests to the audio endpoint's sample frequency property */ - if ((EndpointIndex == AUDIO_STREAM_EPNUM) && (EndpointControl == AUDIO_EPCONTROL_SamplingFreq)) + if ((EndpointAddress == (ENDPOINT_DESCRIPTOR_DIR_IN | AUDIO_STREAM_EPNUM)) && (EndpointControl == AUDIO_EPCONTROL_SamplingFreq)) { uint8_t SampleRate[3]; Endpoint_ClearSETUP(); Endpoint_Read_Control_Stream_LE(SampleRate, sizeof(SampleRate)); - Endpoint_ClearOUT(); + Endpoint_ClearIN(); /* Set the new sampling frequency to the value given by the host */ CurrentAudioSampleFrequency = (((uint32_t)SampleRate[2] << 16) | ((uint32_t)SampleRate[1] << 8) | (uint32_t)SampleRate[0]); @@ -183,14 +183,14 @@ void EVENT_USB_Device_ControlRequest(void) break; case AUDIO_REQ_GetCurrent: - if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_ENDPOINT)) + if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_ENDPOINT)) { - /* Extract out the relevant request information to get the target Endpoint index and control being retrieved */ - uint8_t EndpointIndex = (uint8_t)USB_ControlRequest.wIndex; + /* Extract out the relevant request information to get the target Endpoint address and control being retrieved */ + uint8_t EndpointAddress = (uint8_t)USB_ControlRequest.wIndex; uint8_t EndpointControl = (USB_ControlRequest.wValue >> 8); /* Only handle GET CURRENT requests to the audio endpoint's sample frequency property */ - if ((EndpointIndex == AUDIO_STREAM_EPNUM) && (EndpointControl == AUDIO_EPCONTROL_SamplingFreq)) + if ((EndpointAddress == (ENDPOINT_DESCRIPTOR_DIR_IN | AUDIO_STREAM_EPNUM)) && (EndpointControl == AUDIO_EPCONTROL_SamplingFreq)) { uint8_t SampleRate[3]; |