diff options
author | Keith Packard <keithp@keithp.com> | 2012-01-03 20:46:25 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2012-01-03 20:46:25 -0800 |
commit | c6821ae734a7efaf2e069f6c5edf9605a9dbe125 (patch) | |
tree | 9e3798f1999d1e0c2dd0be24ead830b83ec2cc42 | |
parent | 65b9b5d0d91fef2c7452dc77017f31f176672304 (diff) |
altos: flush stdout when fifo from arduino serial port is empty
This avoids leaving bytes pending inside altos
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | src/core/ao.h | 4 | ||||
-rw-r--r-- | src/teleshield-v0.1/ao_ardu_serial.c | 2 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/core/ao.h b/src/core/ao.h index 494993f1..8c5335c4 100644 --- a/src/core/ao.h +++ b/src/core/ao.h @@ -943,6 +943,10 @@ ao_serial_init(void); #endif #if HAS_SERIAL_0 + +extern volatile __xdata struct ao_fifo ao_usart0_rx_fifo; +extern volatile __xdata struct ao_fifo ao_usart0_tx_fifo; + void ao_serial0_rx0_isr(void) ao_arch_interrupt(2); diff --git a/src/teleshield-v0.1/ao_ardu_serial.c b/src/teleshield-v0.1/ao_ardu_serial.c index 7d4dc0db..7ff859af 100644 --- a/src/teleshield-v0.1/ao_ardu_serial.c +++ b/src/teleshield-v0.1/ao_ardu_serial.c @@ -23,6 +23,8 @@ ao_ardu_serial_recv(void) char c; for (;;) { + if (ao_fifo_empty(ao_usart0_rx_fifo)) + flush(); c = ao_serial0_getchar(); putchar (c); } |