1
0
Fork 0
i237/src/uart_wrap.c

40 lines
813 B
C
Raw Normal View History

2016-11-07 01:42:18 +02:00
#include <avr/io.h>
#include <stdio.h>
#include "../lib/andygock_avr-uart/uart.h"
2016-12-01 16:19:28 +02:00
#define UART_STATUS_MASK 0x00FF
2016-11-07 01:42:18 +02:00
int uart0_putc_wrap(char c, FILE *stream)
{
(void) stream;
if (c == '\n') {
uart0_putc_wrap('\r', stream);
}
uart0_putc(c);
return 0;
}
int uart0_getc_wrap(FILE *stream)
{
(void) stream;
2016-11-20 00:51:04 +02:00
// Probabbly should add some error checking in here but because
// this function is only called out when there is at least one character
// available in the input buffer (see main.c line 114) then error checking
// is not currently necessary.
2016-12-01 16:19:28 +02:00
return uart0_getc() & UART_STATUS_MASK;
2016-11-07 01:42:18 +02:00
}
int uart3_putc_wrap(char c, FILE *stream)
{
(void) stream;
if (c == '\n') {
uart3_putc_wrap('\r', stream);
}
uart3_putc(c);
return 0;
}