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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user