diff options
-rw-r--r-- | uart.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -1,4 +1,5 @@ -static char txbuf[64]; +#define TXBSIZE 128 +static char txbuf[TXBSIZE]; static uint8_t txput = 0, txsend = 0; ISR(USART_RX_vect) @@ -11,7 +12,7 @@ ISR(USART_UDRE_vect) if (txsend != txput) { UDR0 = txbuf[txsend]; txsend++; - txsend &= 63; + txsend &= TXBSIZE - 1; UCSR0B = (1 << RXCIE0) | (1 << UDRIE0) | (1 << RXEN0) | (1 << TXEN0); } else { UCSR0B = (1 << RXCIE0) | (1 << RXEN0) | (1 << TXEN0); @@ -22,7 +23,7 @@ static void _uart_putch(const char ch) { txbuf[txput] = ch; txput++; - txput &= 63; + txput &= TXBSIZE - 1; } static void uart_putpgm(PGM_P str) |