Add LUFA-side channel open/close routines, add signalling handlers for the creation...
[pub/USBasp.git] / Demos / Device / LowLevel / VirtualSerial / VirtualSerial.c
index 444dc01..bad8757 100644 (file)
@@ -1,21 +1,21 @@
 /*\r
              LUFA Library\r
 /*\r
              LUFA Library\r
-     Copyright (C) Dean Camera, 2009.\r
+     Copyright (C) Dean Camera, 2010.\r
               \r
   dean [at] fourwalledcubicle [dot] com\r
       www.fourwalledcubicle.com\r
 */\r
 \r
 /*\r
               \r
   dean [at] fourwalledcubicle [dot] com\r
       www.fourwalledcubicle.com\r
 */\r
 \r
 /*\r
-  Copyright 2009  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
-\r
-  Permission to use, copy, modify, and distribute this software\r
-  and its documentation for any purpose and without fee is hereby\r
-  granted, provided that the above copyright notice appear in all\r
-  copies and that both that the copyright notice and this\r
-  permission notice and warranty disclaimer appear in supporting\r
-  documentation, and that the name of the author not be used in\r
-  advertising or publicity pertaining to distribution of the\r
+  Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
+\r
+  Permission to use, copy, modify, distribute, and sell this \r
+  software and its documentation for any purpose is hereby granted\r
+  without fee, provided that the above copyright notice appear in \r
+  all copies and that both that the copyright notice and this\r
+  permission notice and warranty disclaimer appear in supporting \r
+  documentation, and that the name of the author not be used in \r
+  advertising or publicity pertaining to distribution of the \r
   software without specific, written prior permission.\r
 \r
   The author disclaim all warranties with regard to this\r
   software without specific, written prior permission.\r
 \r
   The author disclaim all warranties with regard to this\r
 \r
 /** \file\r
  *\r
 \r
 /** \file\r
  *\r
- *  Main source file for the CDC demo. This file contains the main tasks of the demo and\r
+ *  Main source file for the VirtualSerial demo. This file contains the main tasks of the demo and\r
  *  is responsible for the initial application hardware configuration.\r
  */\r
 \r
  *  is responsible for the initial application hardware configuration.\r
  */\r
 \r
-#include "CDC.h"\r
+#include "VirtualSerial.h"\r
 \r
 /** Contains the current baud rate and other settings of the virtual serial port. While this demo does not use\r
  *  the physical USART and thus does not use these settings, they must still be retained and returned to the host\r
 \r
 /** Contains the current baud rate and other settings of the virtual serial port. While this demo does not use\r
  *  the physical USART and thus does not use these settings, they must still be retained and returned to the host\r
@@ -49,59 +49,6 @@ CDC_Line_Coding_t LineEncoding = { .BaudRateBPS = 0,
                                    .ParityType  = Parity_None,\r
                                    .DataBits    = 8            };\r
 \r
                                    .ParityType  = Parity_None,\r
                                    .DataBits    = 8            };\r
 \r
-\r
-#if 0\r
-/* NOTE: Here you can set up a standard stream using the created virtual serial port, so that the standard stream functions in\r
- *       <stdio.h> can be used on the virtual serial port (e.g. fprintf(&USBSerial, "Test"); to print a string).\r
- */\r
-       \r
-static int CDC_putchar(char c, FILE *stream)\r
-{        \r
-       Endpoint_SelectEndpoint(CDC_TX_EPNUM);\r
-\r
-       if (!(LineEncoding.BaudRateBPS))\r
-         return -1;\r
-       \r
-       if (Endpoint_WaitUntilReady())\r
-         return -1;\r
-\r
-       Endpoint_Write_Byte(c);\r
-       Endpoint_ClearIN();\r
-       \r
-       return 0;\r
-}\r
-\r
-static int CDC_getchar(FILE *stream)\r
-{\r
-       int c;\r
-\r
-       if (!(LineEncoding.BaudRateBPS))\r
-         return -1;\r
-\r
-       Endpoint_SelectEndpoint(CDC_RX_EPNUM);\r
-       \r
-       for (;;)\r
-       {\r
-               if (Endpoint_WaitUntilReady())\r
-                 return -1;\r
-       \r
-               if (!(Endpoint_BytesInEndpoint()))\r
-               {\r
-                       Endpoint_ClearOUT();\r
-               }\r
-               else\r
-               {\r
-                       c = Endpoint_Read_Byte();\r
-                       break;\r
-               }\r
-       }\r
-       \r
-       return c;\r
-}\r
-\r
-static FILE USBSerial = FDEV_SETUP_STREAM(CDC_putchar, CDC_getchar, _FDEV_SETUP_RW);\r
-#endif\r
-\r
 /** Main program entry point. This routine contains the overall program flow, including initial\r
  *  setup of all components and the main program loop.\r
  */\r
 /** Main program entry point. This routine contains the overall program flow, including initial\r
  *  setup of all components and the main program loop.\r
  */\r