Added stdio.h stream examples for the virtual CDC UART in the CDC host demos.
authorDean Camera <dean@fourwalledcubicle.com>
Sun, 11 Oct 2009 06:14:08 +0000 (06:14 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Sun, 11 Oct 2009 06:14:08 +0000 (06:14 +0000)
Removed accidental reference to the incomplete MIDI class bootloader in the Bootloader folder makefile.

Bootloaders/makefile
Demos/Host/ClassDriver/CDCHost/CDCHost.c
Demos/Host/LowLevel/CDCHost/CDCHost.c
LUFA/ManPages/ChangeLog.txt
LUFA/ManPages/FutureChanges.txt

index 5fd5aef..1083587 100644 (file)
@@ -26,5 +26,4 @@ all:
 %:\r
        make -C 'DFU/' $@\r
        make -C 'CDC/' $@\r
-       make -C 'MIDI/' $@\r
        make -C 'TeensyHID/' $@\r
index fd12137..99c0c81 100644 (file)
@@ -50,6 +50,27 @@ USB_ClassInfo_CDC_Host_t VirtualSerial_CDC_Interface =
                        },\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
+       CDC_Host_SendByte(&VirtualSerial_CDC_Interface, c);\r
+       return 0;\r
+}\r
+\r
+static int CDC_getchar(FILE *stream)\r
+{\r
+       if (!(CDC_Host_BytesReceived(&VirtualSerial_CDC_Interface)))\r
+         return -1;\r
+\r
+       return CDC_Host_ReceiveByte(&VirtualSerial_CDC_Interface);\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 configures the hardware required by the application, then\r
  *  enters a loop to run the application tasks in sequence.\r
index 7a1788b..0b09c5a 100644 (file)
  \r
 #include "CDCHost.h"\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
+       Pipe_SelectPipe(CDC_DATAPIPE_OUT);\r
+       \r
+       if (Pipe_WaitUntilReady())\r
+         return -1;\r
+\r
+       Pipe_Write_Byte(c);\r
+       Pipe_ClearIN();\r
+       \r
+       return 0;\r
+}\r
+\r
+static int CDC_getchar(FILE *stream)\r
+{\r
+       int c;\r
+\r
+       Pipe_SelectPipe(CDC_DATAPIPE_IN);\r
+       \r
+       for (;;)\r
+       {\r
+               if (Pipe_WaitUntilReady())\r
+                 return -1;\r
+       \r
+               if (!(Pipe_BytesInPipe()))\r
+               {\r
+                       Pipe_ClearOUT();\r
+               }\r
+               else\r
+               {\r
+                       c = Pipe_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 configures the hardware required by the application, then\r
  *  enters a loop to run the application tasks in sequence.\r
  */\r
index e0750de..b47097c 100644 (file)
@@ -13,6 +13,7 @@
   *  - Added new HID_HOST_BOOT_PROTOCOL_ONLY compile time token to reduce the size of the HID Host Class driver when\r
   *    Report protocol is not needed\r
   *  - Added new MIDI LowLevel and ClassDriver Host demo, add new MIDI Host Class driver\r
+  *  - Added stdio.h stream examples for the virtual CDC UART in the CDC host demos\r
   *\r
   *  <b>Changed:</b>\r
   *  - Removed mostly useless "TestApp" demo, as it was mainly useful only for checking for sytax errors in the library\r
index 59c51b1..2ca27ec 100644 (file)
@@ -22,7 +22,7 @@
   *  - Master LUFA include file rather than per-module includes\r
   *  - Change makefiles to allow for absolute LUFA location to be used\r
   *  - Abstract out the physical media from the Mass Storage device demos\r
-  *  - Add MIDI Host Class driver\r
+  *  - Add RNDIS Host Class driver\r
   *  - Make new demos\r
   *      -# Multiple-report HID device\r
   *      -# Mouse/CDC Dual Class Device\r