summaryrefslogtreecommitdiffstats
path: root/stdio.c
diff options
context:
space:
mode:
Diffstat (limited to 'stdio.c')
-rw-r--r--stdio.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/stdio.c b/stdio.c
new file mode 100644
index 0000000..db54136
--- /dev/null
+++ b/stdio.c
@@ -0,0 +1,23 @@
+#include "project.h"
+
+static int
+stdio_uart_putchar (char var, FILE * stream)
+{
+ if (var == '\n')
+ usb_serial_putchar_nowait ('\r');
+ usb_serial_putchar_nowait (var);
+ return 0;
+}
+
+
+static FILE stdio_uart_stdout =
+FDEV_SETUP_STREAM (stdio_uart_putchar, NULL, _FDEV_SETUP_WRITE);
+
+void
+stdio_init (void)
+{
+ stdout = &stdio_uart_stdout;
+ usb_init();
+// while (!usb_configured()) /* wait */ ;
+ usb_serial_flush_input();
+}