Clean up excessive whitespace at the end of each line using the wspurify tool made...
[pub/USBasp.git] / Demos / Device / ClassDriver / MIDI / MIDI.c
index bfeeaa3..cae7277 100644 (file)
@@ -1,7 +1,7 @@
 /*
              LUFA Library
      Copyright (C) Dean Camera, 2010.
 /*
              LUFA Library
      Copyright (C) Dean Camera, 2010.
-              
+
   dean [at] fourwalledcubicle [dot] com
       www.fourwalledcubicle.com
 */
   dean [at] fourwalledcubicle [dot] com
       www.fourwalledcubicle.com
 */
@@ -9,13 +9,13 @@
 /*
   Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)
 
 /*
   Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)
 
-  Permission to use, copy, modify, distribute, and sell this 
+  Permission to use, copy, modify, distribute, and sell this
   software and its documentation for any purpose is hereby granted
   software and its documentation for any purpose is hereby granted
-  without fee, provided that the above copyright notice appear in 
+  without fee, provided that the above copyright notice appear in
   all copies and that both that the copyright notice and this
   all copies and that both that the copyright notice and this
-  permission notice and warranty disclaimer appear in supporting 
-  documentation, and that the name of the author not be used in 
-  advertising or publicity pertaining to distribution of the 
+  permission notice and warranty disclaimer appear in supporting
+  documentation, and that the name of the author not be used in
+  advertising or publicity pertaining to distribution of the
   software without specific, written prior permission.
 
   The author disclaim all warranties with regard to this
   software without specific, written prior permission.
 
   The author disclaim all warranties with regard to this
@@ -65,11 +65,11 @@ int main(void)
 
        LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
        sei();
 
        LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
        sei();
-       
+
        for (;;)
        {
                CheckJoystickMovement();
        for (;;)
        {
                CheckJoystickMovement();
-               
+
                MIDI_EventPacket_t ReceivedMIDIEvent;
                if (MIDI_Device_ReceiveEventPacket(&Keyboard_MIDI_Interface, &ReceivedMIDIEvent))
                {
                MIDI_EventPacket_t ReceivedMIDIEvent;
                if (MIDI_Device_ReceiveEventPacket(&Keyboard_MIDI_Interface, &ReceivedMIDIEvent))
                {
@@ -78,7 +78,7 @@ int main(void)
                        else
                          LEDs_SetAllLEDs(LEDS_NO_LEDS);
                }
                        else
                          LEDs_SetAllLEDs(LEDS_NO_LEDS);
                }
-       
+
                MIDI_Device_USBTask(&Keyboard_MIDI_Interface);
                USB_USBTask();
        }
                MIDI_Device_USBTask(&Keyboard_MIDI_Interface);
                USB_USBTask();
        }
@@ -93,7 +93,7 @@ void SetupHardware(void)
 
        /* Disable clock division */
        clock_prescale_set(clock_div_1);
 
        /* Disable clock division */
        clock_prescale_set(clock_div_1);
-       
+
        /* Hardware Initialization */
        Joystick_Init();
        LEDs_Init();
        /* Hardware Initialization */
        Joystick_Init();
        LEDs_Init();
@@ -108,11 +108,11 @@ void CheckJoystickMovement(void)
 
        uint8_t MIDICommand = 0;
        uint8_t MIDIPitch;
 
        uint8_t MIDICommand = 0;
        uint8_t MIDIPitch;
-       
+
        /* Get current joystick mask, XOR with previous to detect joystick changes */
        uint8_t JoystickStatus  = Joystick_GetStatus();
        uint8_t JoystickChanges = (JoystickStatus ^ PrevJoystickStatus);
        /* Get current joystick mask, XOR with previous to detect joystick changes */
        uint8_t JoystickStatus  = Joystick_GetStatus();
        uint8_t JoystickChanges = (JoystickStatus ^ PrevJoystickStatus);
-               
+
        /* Get board button status - if pressed use channel 10 (percussion), otherwise use channel 1 */
        uint8_t Channel = ((Buttons_GetStatus() & BUTTONS_BUTTON1) ? MIDI_CHANNEL(10) : MIDI_CHANNEL(1));
 
        /* Get board button status - if pressed use channel 10 (percussion), otherwise use channel 1 */
        uint8_t Channel = ((Buttons_GetStatus() & BUTTONS_BUTTON1) ? MIDI_CHANNEL(10) : MIDI_CHANNEL(1));
 
@@ -133,7 +133,7 @@ void CheckJoystickMovement(void)
                MIDICommand = ((JoystickStatus & JOY_RIGHT)? MIDI_COMMAND_NOTE_ON : MIDI_COMMAND_NOTE_OFF);
                MIDIPitch   = 0x3E;
        }
                MIDICommand = ((JoystickStatus & JOY_RIGHT)? MIDI_COMMAND_NOTE_ON : MIDI_COMMAND_NOTE_OFF);
                MIDIPitch   = 0x3E;
        }
-       
+
        if (JoystickChanges & JOY_DOWN)
        {
                MIDICommand = ((JoystickStatus & JOY_DOWN)? MIDI_COMMAND_NOTE_ON : MIDI_COMMAND_NOTE_OFF);
        if (JoystickChanges & JOY_DOWN)
        {
                MIDICommand = ((JoystickStatus & JOY_DOWN)? MIDI_COMMAND_NOTE_ON : MIDI_COMMAND_NOTE_OFF);
@@ -145,19 +145,19 @@ void CheckJoystickMovement(void)
                MIDICommand = ((JoystickStatus & JOY_PRESS)? MIDI_COMMAND_NOTE_ON : MIDI_COMMAND_NOTE_OFF);
                MIDIPitch   = 0x3B;
        }
                MIDICommand = ((JoystickStatus & JOY_PRESS)? MIDI_COMMAND_NOTE_ON : MIDI_COMMAND_NOTE_OFF);
                MIDIPitch   = 0x3B;
        }
-       
+
        if (MIDICommand)
        {
                MIDI_EventPacket_t MIDIEvent = (MIDI_EventPacket_t)
                        {
                                .CableNumber = 0,
                                .Command     = (MIDICommand >> 4),
        if (MIDICommand)
        {
                MIDI_EventPacket_t MIDIEvent = (MIDI_EventPacket_t)
                        {
                                .CableNumber = 0,
                                .Command     = (MIDICommand >> 4),
-                               
+
                                .Data1       = MIDICommand | Channel,
                                .Data2       = MIDIPitch,
                                .Data1       = MIDICommand | Channel,
                                .Data2       = MIDIPitch,
-                               .Data3       = MIDI_STANDARD_VELOCITY,                  
+                               .Data3       = MIDI_STANDARD_VELOCITY,
                        };
                        };
-                       
+
                MIDI_Device_SendEventPacket(&Keyboard_MIDI_Interface, &MIDIEvent);
                MIDI_Device_Flush(&Keyboard_MIDI_Interface);
        }
                MIDI_Device_SendEventPacket(&Keyboard_MIDI_Interface, &MIDIEvent);
                MIDI_Device_Flush(&Keyboard_MIDI_Interface);
        }
@@ -192,3 +192,4 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
 {
        MIDI_Device_ProcessControlRequest(&Keyboard_MIDI_Interface);
 }
 {
        MIDI_Device_ProcessControlRequest(&Keyboard_MIDI_Interface);
 }
+