From dcfe43860be2daf118e81a59029a34f018926ae5 Mon Sep 17 00:00:00 2001 From: James McKenzie Date: Mon, 15 Dec 2014 12:10:09 +0000 Subject: fish --- stdio.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 stdio.c (limited to 'stdio.c') 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(); +} -- cgit v1.2.3