probe-rs / rtt-target

Target side implementation of the RTT (Real-Time Transfer) I/O protocol
MIT License
115 stars 29 forks source link

[FR] expose `write(_, buf: &[u8])` when `set_print_channel()` used #20

Open ildar opened 3 years ago

ildar commented 3 years ago

the set_print_channel() consumes the channel hence write(channel, buf: &[u8]) can't be used. And rtt_print() doesn't accept &[u8]. The situation when I need to write [u8] is trivial: to echo bytes I receive with read() from down channel.

mvirkkunen commented 2 years ago

If you want to send actual binary data, I think it's better to write directly to the channel. The printing facility is really only meant for printing text. If it's actually text, you can use core::str::from_utf8 to convert it to an str for printing.