[−][src]Function tmc2209::await_read
pub fn await_read<R, U>(uart_rx: &mut U) -> Result<R, UnknownAddress> where
R: ReadableRegister,
U: Read<u8>,
Blocks and attempts to read a register from the given UART receiver.
Expects the response to be addressed to the register of type R
and returns an error
otherwise.
Internally, this calls await_read_response
and then the register
method of the resulting
response.
NOTE: Currently, this function will block until a response can be successfully read. This
means the function may block forever in the case some communication error occurs. Once a
generic timer API lands in the embedded-hal
crate, this should be changed to take a timeout
duration and return with a timeout error in the case that the duration is exceeded before a
response can be read. In the meantime, consider using the Reader
and its read_response
method directly to avoid blocking or apply your own timeout logic.