projects
/
pub
/
USBasp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Minor updates to the Benito programmer - remove redundant PORT register manipulations.
[pub/USBasp.git]
/
Demos
/
Device
/
LowLevel
/
AudioInput
/
AudioInput.c
diff --git
a/Demos/Device/LowLevel/AudioInput/AudioInput.c
b/Demos/Device/LowLevel/AudioInput/AudioInput.c
index
7757ef1
..
bf79016
100644
(file)
--- a/
Demos/Device/LowLevel/AudioInput/AudioInput.c
+++ b/
Demos/Device/LowLevel/AudioInput/AudioInput.c
@@
-109,13
+109,16
@@
void EVENT_USB_Disconnect(void)
*/
\r
void EVENT_USB_ConfigurationChanged(void)
\r
{
\r
*/
\r
void EVENT_USB_ConfigurationChanged(void)
\r
{
\r
- /* Setup audio stream endpoint */
\r
- Endpoint_ConfigureEndpoint(AUDIO_STREAM_EPNUM, EP_TYPE_ISOCHRONOUS,
\r
- ENDPOINT_DIR_IN, AUDIO_STREAM_EPSIZE,
\r
- ENDPOINT_BANK_DOUBLE);
\r
-
\r
/* Indicate USB connected and ready */
\r
LEDs_SetAllLEDs(LEDMASK_USB_READY);
\r
/* Indicate USB connected and ready */
\r
LEDs_SetAllLEDs(LEDMASK_USB_READY);
\r
+
\r
+ /* Setup audio stream endpoint */
\r
+ if (!(Endpoint_ConfigureEndpoint(AUDIO_STREAM_EPNUM, EP_TYPE_ISOCHRONOUS,
\r
+ ENDPOINT_DIR_IN, AUDIO_STREAM_EPSIZE,
\r
+ ENDPOINT_BANK_DOUBLE)))
\r
+ {
\r
+ LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
\r
+ }
\r
}
\r
\r
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific
\r
}
\r
\r
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific
\r
@@
-136,9
+139,7
@@
void EVENT_USB_UnhandledControlPacket(void)
/* Check if the host is enabling the audio interface (setting AlternateSetting to 1) */
\r
StreamingAudioInterfaceSelected = ((USB_ControlRequest.wValue) != 0);
\r
\r
/* Check if the host is enabling the audio interface (setting AlternateSetting to 1) */
\r
StreamingAudioInterfaceSelected = ((USB_ControlRequest.wValue) != 0);
\r
\r
- /* Acknowledge status stage */
\r
- while (!(Endpoint_IsINReady()));
\r
- Endpoint_ClearIN();
\r
+ Endpoint_ClearStatusStage();
\r
}
\r
\r
break;
\r
}
\r
\r
break;
\r
@@
-148,6
+149,10
@@
void EVENT_USB_UnhandledControlPacket(void)
/** Task to manage the Audio interface, reading in ADC samples from the microphone, and them to the host. */
\r
void USB_Audio_Task(void)
\r
{
\r
/** Task to manage the Audio interface, reading in ADC samples from the microphone, and them to the host. */
\r
void USB_Audio_Task(void)
\r
{
\r
+ /* Device must be connected and configured for the task to run */
\r
+ if (USB_DeviceState != DEVICE_STATE_Configured)
\r
+ return;
\r
+
\r
/* Check to see if the streaming interface is selected, if not the host is not receiving audio */
\r
if (!(StreamingAudioInterfaceSelected))
\r
return;
\r
/* Check to see if the streaming interface is selected, if not the host is not receiving audio */
\r
if (!(StreamingAudioInterfaceSelected))
\r
return;
\r