Changed all Device mode LowLevel demos and Device Class drivers so that the control...
[pub/USBasp.git] / Demos / Device / ClassDriver / AudioInput / AudioInput.c
index dd0028a..ceaeb89 100644 (file)
@@ -98,6 +98,7 @@ void ProcessNextSample(void)
        /* Check if the sample reload timer period has elapsed, and that the USB bus is ready for a new sample */
        if ((TIFR0 & (1 << OCF0A)) && Audio_Device_IsReadyForNextSample(&Microphone_Audio_Interface))
        {
        /* Check if the sample reload timer period has elapsed, and that the USB bus is ready for a new sample */
        if ((TIFR0 & (1 << OCF0A)) && Audio_Device_IsReadyForNextSample(&Microphone_Audio_Interface))
        {
+               /* Clear the sample reload timer compare flag, ready for the next interval */
                TIFR0 |= (1 << OCF0A);
 
                /* Audio sample is ADC value scaled to fit the entire range */
                TIFR0 |= (1 << OCF0A);
 
                /* Audio sample is ADC value scaled to fit the entire range */
@@ -135,10 +136,11 @@ void EVENT_USB_Device_Disconnect(void)
 /** Event handler for the library USB Configuration Changed event. */
 void EVENT_USB_Device_ConfigurationChanged(void)
 {
 /** Event handler for the library USB Configuration Changed event. */
 void EVENT_USB_Device_ConfigurationChanged(void)
 {
-       LEDs_SetAllLEDs(LEDMASK_USB_READY);
-       
-       if (!(Audio_Device_ConfigureEndpoints(&Microphone_Audio_Interface)))
-         LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
+       bool ConfigSuccess = true;
+
+       ConfigSuccess &= Audio_Device_ConfigureEndpoints(&Microphone_Audio_Interface);
+
+       LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
 }
 
 /** Event handler for the library USB Unhandled Control Request event. */
 }
 
 /** Event handler for the library USB Unhandled Control Request event. */