summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--uart.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/uart.c b/uart.c
index fcc5783..feb9619 100644
--- a/uart.c
+++ b/uart.c
@@ -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;