This repository was archived by the owner on May 15, 2021. It is now read-only.
This repository was archived by the owner on May 15, 2021. It is now read-only.
serial::Write implementation is blocking #4
Closed
Description
Opening this issue to avoid polluting rust-embedded/nb#13 with too much device specific discussion.
The current impl embedded_hal::serial::Write for Tx<UART0>
is blocking, the easy implementation of
fn write(&mut self, byte: u8) -> nb::Result<(), !> {
let uart = unsafe { &*UART0::ptr() };
if uart.events_txdrdy.read().bits() == 1 {
uart.events_txdrdy.reset();
uart.txd.write(|w| unsafe { w.bits(u32::from(byte)) });
Ok(())
} else {
Err(nb::Error::WouldBlock)
}
}
doesn't work because events_txdrdy
is only set after a byte is transmitted, not when the peripheral is first enabled. It doesn't appear to be possible to manually set event registers as well.
Metadata
Metadata
Assignees
Labels
No labels