Documentation improvements - put driver example code into its own section, fix incorr...
[pub/USBasp.git] / Demos / Host / LowLevel / VirtualSerialHost / VirtualSerialHost.c
index 91775b7..6d9d79c 100644 (file)
@@ -1,21 +1,21 @@
 /*
              LUFA Library
      Copyright (C) Dean Camera, 2010.
-              
+
   dean [at] fourwalledcubicle [dot] com
-      www.fourwalledcubicle.com
+           www.lufa-lib.org
 */
 
 /*
   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
-  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
-  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
@@ -33,7 +33,7 @@
  *  Main source file for the VirtualSerialHost demo. This file contains the main tasks of
  *  the demo and is responsible for the initial application hardware configuration.
  */
+
 #include "VirtualSerialHost.h"
 
 /** Main program entry point. This routine configures the hardware required by the application, then
@@ -119,7 +119,7 @@ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
                                 " -- Error Code %d\r\n"
                                 " -- Sub Error Code %d\r\n"
                                 " -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState);
-       
+
        LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
 }
 
@@ -134,7 +134,7 @@ void CDC_Host_Task(void)
        {
                case HOST_STATE_Addressed:
                        puts_P(PSTR("Getting Config Data.\r\n"));
-               
+
                        /* Get and process the configuration descriptor data */
                        if ((ErrorCode = ProcessConfigurationDescriptor()) != SuccessfulConfigRead)
                        {
@@ -144,7 +144,7 @@ void CDC_Host_Task(void)
                                  puts_P(PSTR(ESC_FG_RED "Invalid Device.\r\n"));
 
                                printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
-                               
+
                                /* Indicate error via status LEDs */
                                LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
 
@@ -152,7 +152,7 @@ void CDC_Host_Task(void)
                                USB_HostState = HOST_STATE_WaitForDeviceRemoval;
                                break;
                        }
-                       
+
                        /* Set the device configuration to the first configuration (rarely do devices use multiple configurations) */
                        if ((ErrorCode = USB_Host_SetDeviceConfiguration(1)) != HOST_SENDCONTROL_Successful)
                        {
@@ -188,10 +188,10 @@ void CDC_Host_Task(void)
                                        /* Get the length of the pipe data, and create a new buffer to hold it */
                                        uint16_t BufferLength = Pipe_BytesInPipe();
                                        uint8_t  Buffer[BufferLength];
-                                       
+
                                        /* Read in the pipe data to the temporary buffer */
                                        Pipe_Read_Stream_LE(Buffer, BufferLength);
-                                                                       
+
                                        /* Print out the buffer contents to the USART */
                                        for (uint16_t BufferByte = 0; BufferByte < BufferLength; BufferByte++)
                                          putchar(Buffer[BufferByte]);
@@ -207,17 +207,18 @@ void CDC_Host_Task(void)
                        /* Select and unfreeze the notification pipe */
                        Pipe_SelectPipe(CDC_NOTIFICATION_PIPE);
                        Pipe_Unfreeze();
-                       
+
                        /* Check if a packet has been received */
                        if (Pipe_IsINReceived())
                        {
                                /* Discard the unused event notification */
                                Pipe_ClearIN();
                        }
-                       
+
                        /* Freeze notification IN pipe after use */
                        Pipe_Freeze();
-                                               
+
                        break;
        }
 }
+