X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/071e02c6b6b4837fa9cf0b6d4c749994e02638d7..4cc7f5200beef90c39c8c8310ed7c8b849afb4d9:/Demos/Device/ClassDriver/AudioInput/AudioInput.c diff --git a/Demos/Device/ClassDriver/AudioInput/AudioInput.c b/Demos/Device/ClassDriver/AudioInput/AudioInput.c index dd0028a55..ceaeb89a1 100644 --- a/Demos/Device/ClassDriver/AudioInput/AudioInput.c +++ b/Demos/Device/ClassDriver/AudioInput/AudioInput.c @@ -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)) { + /* 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 */ @@ -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) { - 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. */