diff options
author | David Lamparter <equinox@diac24.net> | 2012-05-17 02:30:01 +0200 |
---|---|---|
committer | David Lamparter <equinox@diac24.net> | 2012-05-17 02:30:01 +0200 |
commit | a09ebf4a690b86b7cc629d3c1a9e18c4ab4fc097 (patch) | |
tree | e2303c64a058d792ff8af4d28e37e49bbb4ee640 | |
parent | 937ce1ef539a7a73d481e9392c27b860d9b5eb14 (diff) |
uart: volatile/uart_wait()
-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; |