X-Git-Url: http://git.kpe.io/?p=avr_bc100.git;a=blobdiff_plain;f=BaseMegaFirmware%2FGCC%2Fmystdio.c;fp=BaseMegaFirmware%2FGCC%2Fmystdio.c;h=9fe8a2435bd1d4b6548aacb2ebc67e11722cc8d0;hp=0000000000000000000000000000000000000000;hb=89173ec9cd6f33843bf27c45be0f2f9be3f5f0ce;hpb=7997f136b12114035265bd082c854bff95fd73dc diff --git a/BaseMegaFirmware/GCC/mystdio.c b/BaseMegaFirmware/GCC/mystdio.c new file mode 100644 index 0000000..9fe8a24 --- /dev/null +++ b/BaseMegaFirmware/GCC/mystdio.c @@ -0,0 +1,22 @@ +// Martin Thomas 3/2008 + +#include +#include "uart.h" +#include "mystdio.h" + +static int uart_putchar( char c, FILE *stream ) +{ + if ( c == '\n' ) { + uart_putc( '\r' ); + } + uart_putc( c ); + + return 0; +} + +static FILE uart_stream = FDEV_SETUP_STREAM(uart_putchar, NULL, _FDEV_SETUP_WRITE); + +void mystdio_init(void) +{ + stdout = &uart_stream; +}