Clean up excessive whitespace at the end of each line using the wspurify tool made...
[pub/USBasp.git] / Demos / Device / LowLevel / MIDI / MIDI.c
index 87ecbd4..4696d23 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
 int main(void)
 {
        SetupHardware();
 int main(void)
 {
        SetupHardware();
-       
+
        LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
        sei();
        LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
        sei();
-       
+
        for (;;)
        {
                MIDI_Task();
        for (;;)
        {
                MIDI_Task();
@@ -62,7 +62,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();
@@ -100,7 +100,7 @@ void EVENT_USB_Device_ConfigurationChanged(void)
                                                    MIDI_STREAM_EPSIZE, ENDPOINT_BANK_SINGLE);
 
        /* Indicate endpoint configuration success or failure */
                                                    MIDI_STREAM_EPSIZE, ENDPOINT_BANK_SINGLE);
 
        /* Indicate endpoint configuration success or failure */
-       LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR); 
+       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
 }
 
 /** Task to handle the generation of MIDI note change events in response to presses of the board joystick, and send them
@@ -120,10 +120,10 @@ void MIDI_Task(void)
        {
                uint8_t MIDICommand = 0;
                uint8_t MIDIPitch;
        {
                uint8_t MIDICommand = 0;
                uint8_t MIDIPitch;
-       
+
                uint8_t JoystickStatus  = Joystick_GetStatus();
                uint8_t JoystickChanges = (JoystickStatus ^ PrevJoystickStatus);
                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));
 
@@ -144,7 +144,7 @@ void MIDI_Task(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);
@@ -164,19 +164,19 @@ void MIDI_Task(void)
                                {
                                        .CableNumber = 0,
                                        .Command     = (MIDICommand >> 4),
                                {
                                        .CableNumber = 0,
                                        .Command     = (MIDICommand >> 4),
-                                       
+
                                        .Data1       = MIDICommand | Channel,
                                        .Data2       = MIDIPitch,
                                        .Data1       = MIDICommand | Channel,
                                        .Data2       = MIDIPitch,
-                                       .Data3       = MIDI_STANDARD_VELOCITY,                  
+                                       .Data3       = MIDI_STANDARD_VELOCITY,
                                };
                                };
-                               
+
                        /* Write the MIDI event packet to the endpoint */
                        Endpoint_Write_Stream_LE(&MIDIEvent, sizeof(MIDIEvent));
                        /* Write the MIDI event packet to the endpoint */
                        Endpoint_Write_Stream_LE(&MIDIEvent, sizeof(MIDIEvent));
-               
+
                        /* Send the data in the endpoint to the host */
                        Endpoint_ClearIN();
                }
                        /* Send the data in the endpoint to the host */
                        Endpoint_ClearIN();
                }
-               
+
                /* Save previous joystick value for next joystick change detection */
                PrevJoystickStatus = JoystickStatus;
        }
                /* Save previous joystick value for next joystick change detection */
                PrevJoystickStatus = JoystickStatus;
        }
@@ -188,10 +188,10 @@ void MIDI_Task(void)
        if (Endpoint_IsOUTReceived())
        {
                USB_MIDI_EventPacket_t MIDIEvent;
        if (Endpoint_IsOUTReceived())
        {
                USB_MIDI_EventPacket_t MIDIEvent;
-                       
+
                /* Read the MIDI event packet from the endpoint */
                Endpoint_Read_Stream_LE(&MIDIEvent, sizeof(MIDIEvent));
                /* Read the MIDI event packet from the endpoint */
                Endpoint_Read_Stream_LE(&MIDIEvent, sizeof(MIDIEvent));
-       
+
                /* Check to see if the sent command is a note on message with a non-zero velocity */
                if ((MIDIEvent.Command == (MIDI_COMMAND_NOTE_ON >> 4)) && (MIDIEvent.Data3 > 0))
                {
                /* Check to see if the sent command is a note on message with a non-zero velocity */
                if ((MIDIEvent.Command == (MIDI_COMMAND_NOTE_ON >> 4)) && (MIDIEvent.Data3 > 0))
                {
@@ -203,8 +203,9 @@ void MIDI_Task(void)
                        /* Turn off all LEDs in response to non Note On messages */
                        LEDs_SetAllLEDs(LEDS_NO_LEDS);
                }
                        /* Turn off all LEDs in response to non Note On messages */
                        LEDs_SetAllLEDs(LEDS_NO_LEDS);
                }
-       
+
                /* Clear the endpoint ready for new packet */
                Endpoint_ClearOUT();
        }
 }
                /* Clear the endpoint ready for new packet */
                Endpoint_ClearOUT();
        }
 }
+