Fixed MIDI_Host_Flush() not aborting early when the specified MIDI host interface...
[pub/USBasp.git] / Demos / Device / LowLevel / MIDI / MIDI.c
index a9843ed..87ecbd4 100644 (file)
@@ -91,23 +91,16 @@ void EVENT_USB_Device_Disconnect(void)
  */
 void EVENT_USB_Device_ConfigurationChanged(void)
 {
-       /* Indicate USB connected and ready */
-       LEDs_SetAllLEDs(LEDMASK_USB_READY);
+       bool ConfigSuccess = true;
 
-       /* Setup MIDI stream endpoints */
-       if (!(Endpoint_ConfigureEndpoint(MIDI_STREAM_OUT_EPNUM, EP_TYPE_BULK,
-                                            ENDPOINT_DIR_OUT, MIDI_STREAM_EPSIZE,
-                                        ENDPOINT_BANK_SINGLE)))
-       {
-               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
-       }       
-       
-       if (!(Endpoint_ConfigureEndpoint(MIDI_STREAM_IN_EPNUM, EP_TYPE_BULK,
-                                            ENDPOINT_DIR_IN, MIDI_STREAM_EPSIZE,
-                                        ENDPOINT_BANK_SINGLE)))
-       {
-               LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
-       }
+       /* Setup MIDI Data Endpoints */
+       ConfigSuccess &= Endpoint_ConfigureEndpoint(MIDI_STREAM_IN_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_IN,
+                                                   MIDI_STREAM_EPSIZE, ENDPOINT_BANK_SINGLE);
+       ConfigSuccess &= Endpoint_ConfigureEndpoint(MIDI_STREAM_OUT_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_OUT,
+                                                   MIDI_STREAM_EPSIZE, ENDPOINT_BANK_SINGLE);
+
+       /* Indicate endpoint configuration success or failure */
+       LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR); 
 }
 
 /** Task to handle the generation of MIDI note change events in response to presses of the board joystick, and send them