stm32f7xx-hal icon indicating copy to clipboard operation
stm32f7xx-hal copied to clipboard

Support `core::fmt::Write` on UARTs

Open thejpster opened this issue 5 years ago • 1 comments

I've found it useful in the past if the UART object implements core::fmt::Write. This would mean you can write:

let serial = Serial(...);
writeln!(serial, "Hello, {}!", name).unwrap();

I tried doing my own impl in my application, but as I've defined neither the core::fmt::Write trait, nor the Serial object, the compiler won't let me (even with the changes that went into 1.41).

thejpster avatar Feb 01 '20 10:02 thejpster

I just found out, it does work with Tx:

let serial = Serial::new(...);
let (tx, rx) = serial.split();
writeln!(tx, "Hello, {}!", name).unwrap();

Wouldn't that be enough?

ctron avatar Sep 17 '20 13:09 ctron