Fixed PDI/TPI programming speed of ~250KHz in the AVRISP-MKII Clone project, instead...
[pub/USBasp.git] / LUFA / Drivers / USB / Class / Device / MIDI.c
index f7c59b5..78d9043 100644 (file)
@@ -3,7 +3,7 @@
      Copyright (C) Dean Camera, 2010.
 
   dean [at] fourwalledcubicle [dot] com
-      www.fourwalledcubicle.com
+           www.lufa-lib.org
 */
 
 /*
@@ -76,24 +76,31 @@ bool MIDI_Device_ConfigureEndpoints(USB_ClassInfo_MIDI_Device_t* const MIDIInter
        return true;
 }
 
+void MIDI_Device_USBTask(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo)
+{
+       if (USB_DeviceState != DEVICE_STATE_Configured)
+         return;
+
+       #if !defined(NO_CLASS_DRIVER_AUTOFLUSH)
+       MIDI_Device_Flush(MIDIInterfaceInfo);
+       #endif
+}
+
 uint8_t MIDI_Device_SendEventPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo,
                                     const MIDI_EventPacket_t* const Event)
 {
        if (USB_DeviceState != DEVICE_STATE_Configured)
          return ENDPOINT_RWSTREAM_DeviceDisconnected;
 
-       Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataINEndpointNumber);
+       uint8_t ErrorCode;
 
-       if (Endpoint_IsReadWriteAllowed())
-       {
-               uint8_t ErrorCode;
+       Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataINEndpointNumber);
 
-               if ((ErrorCode = Endpoint_Write_Stream_LE(Event, sizeof(MIDI_EventPacket_t), NO_STREAM_CALLBACK)) != ENDPOINT_RWSTREAM_NoError)
-                 return ErrorCode;
+       if ((ErrorCode = Endpoint_Write_Stream_LE(Event, sizeof(MIDI_EventPacket_t), NO_STREAM_CALLBACK)) != ENDPOINT_RWSTREAM_NoError)
+         return ErrorCode;
 
-               if (!(Endpoint_IsReadWriteAllowed()))
-                 Endpoint_ClearIN();
-       }
+       if (!(Endpoint_IsReadWriteAllowed()))
+         Endpoint_ClearIN();
 
        return ENDPOINT_RWSTREAM_NoError;
 }