rust-embedded-community / usbd-serial

Work-in progress minimal CDC-ACM (USB serial port) class for usb-device
MIT License
116 stars 35 forks source link

implement core::fmt::Write #16

Closed TDHolmes closed 3 years ago

TDHolmes commented 3 years ago

Implements the core::fmt::Write trait to enable things likeserial.write_fmt(format_args!("{}\r\n", val)); (see working example here)

TDHolmes commented 3 years ago

hi @mvirkkunen, any thoughts on this PR?

mvirkkunen commented 3 years ago

As the code is this will always lose data with no indication when the buffer is full. I'm not sure if that's a good thing.

I'm also not sure if it's even possible to implement fmt::Write in a usable way like @Disasm mentioned. At least not with now usb-device works currently.

TDHolmes commented 3 years ago

Thanks for the feedback. Not sure how to move forward with this one, so closing.