Add explicit guards to all device mode tasks to ensure the device is connected and configured before running the task, to prevent any user tasks from locking up the main USB task if the device has not been properly configured.
This commit is contained in:
parent
bf50959b80
commit
67f390fe74
19 changed files with 245 additions and 216 deletions
|
@ -151,6 +151,10 @@ void EVENT_USB_UnhandledControlPacket(void)
|
|||
/** Task to manage the Audio interface, reading in ADC samples from the microphone, and them to the host. */
|
||||
void USB_Audio_Task(void)
|
||||
{
|
||||
/* Device must be connected and configured for the task to run */
|
||||
if (!(USB_IsConnected) || !(USB_ConfigurationNumber))
|
||||
return;
|
||||
|
||||
/* Check to see if the streaming interface is selected, if not the host is not receiving audio */
|
||||
if (!(StreamingAudioInterfaceSelected))
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue