Add custom footer to the main library documentation.
[pub/USBasp.git] / Demos / Host / LowLevel / MIDIHost / MIDIHost.c
index b616b67..d9060cc 100644 (file)
@@ -1,13 +1,13 @@
 /*
              LUFA Library
-     Copyright (C) Dean Camera, 2010.
+     Copyright (C) Dean Camera, 2011.
 
   dean [at] fourwalledcubicle [dot] com
            www.lufa-lib.org
 */
 
 /*
-  Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)
+  Copyright 2011  Dean Camera (dean [at] fourwalledcubicle [dot] com)
 
   Permission to use, copy, modify, distribute, and sell this
   software and its documentation for any purpose is hereby granted
@@ -192,19 +192,19 @@ void MIDI_Host_Task(void)
                                                                                                           ((MIDIEvent.Data1 & 0x0F) + 1),
                                                                                                           MIDIEvent.Data2, MIDIEvent.Data3);
                                }
-
-                               Pipe_ClearIN();
+                               
+                               if (!(Pipe_BytesInPipe()))
+                                 Pipe_ClearIN();
                        }
 
                        Pipe_SelectPipe(MIDI_DATA_OUT_PIPE);
 
-                       static uint8_t PrevJoystickStatus;
-
                        if (Pipe_IsOUTReady())
                        {
                                uint8_t MIDICommand = 0;
                                uint8_t MIDIPitch;
 
+                               static uint8_t PrevJoystickStatus;
                                uint8_t JoystickStatus  = Joystick_GetStatus();
                                uint8_t JoystickChanges = (JoystickStatus ^ PrevJoystickStatus);