stm32f7xx-hal
stm32f7xx-hal copied to clipboard
Support `core::fmt::Write` on UARTs
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).
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?