forked from M-Labs/zynq-rs
libboard_zynq: flush Uart by waiting for tx idle
This commit is contained in:
parent
0f666c570c
commit
c955eaae7f
|
@ -29,6 +29,6 @@ impl log::Log for Logger {
|
|||
}
|
||||
fn flush(&self) {
|
||||
let uart = stdio::get_uart();
|
||||
while !uart.tx_fifo_empty() {}
|
||||
while !uart.tx_idle() {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@ macro_rules! println {
|
|||
let mut uart = $crate::stdio::get_uart();
|
||||
let _ = write!(uart, $($arg)*);
|
||||
let _ = write!(uart, "\n");
|
||||
while !uart.tx_fifo_empty() {}
|
||||
// flush after the newline
|
||||
while !uart.tx_idle() {}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -221,7 +221,7 @@ impl embedded_hal::serial::Write<u8> for Uart {
|
|||
}
|
||||
|
||||
fn flush(&mut self) -> nb::Result<(), Void> {
|
||||
if self.tx_fifo_empty() {
|
||||
if self.tx_idle() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(nb::Error::WouldBlock)
|
||||
|
|
Loading…
Reference in New Issue