4008-04-07 Release
[avr_bc100.git] / BaseMegaFirmware / GCC / mystdio.c
diff --git a/BaseMegaFirmware/GCC/mystdio.c b/BaseMegaFirmware/GCC/mystdio.c
new file mode 100644 (file)
index 0000000..9fe8a24
--- /dev/null
@@ -0,0 +1,22 @@
+// Martin Thomas 3/2008\r
+\r
+#include <avr/io.h>\r
+#include "uart.h"\r
+#include "mystdio.h"\r
+\r
+static int uart_putchar( char c, FILE *stream )\r
+{\r
+       if ( c == '\n' ) {\r
+               uart_putc( '\r' );\r
+       }\r
+       uart_putc( c );\r
+\r
+       return 0;\r
+}\r
+\r
+static FILE uart_stream = FDEV_SETUP_STREAM(uart_putchar, NULL, _FDEV_SETUP_WRITE);\r
+\r
+void mystdio_init(void)\r
+{\r
+       stdout = &uart_stream;\r
+}\r