diff options
-rw-r--r-- | uart.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -1,6 +1,6 @@ #define TXBSIZE 128 -static char txbuf[TXBSIZE]; -static uint8_t txput = 0, txsend = 0; +static volatile char txbuf[TXBSIZE]; +static volatile uint8_t txput = 0, txsend = 0; ISR(USART_RX_vect) { @@ -19,6 +19,12 @@ ISR(USART_UDRE_vect) } } +static void uart_wait(void) +{ + while (txsend != txput) + asm volatile ("" : : : "memory"); +} + static void _uart_putch(const char ch) { txbuf[txput] = ch; |