Closed jamesmunns closed 5 months ago
From @adamgreig:
https://github.com/embassy-rs/embassy/blob/main/examples/rp/src/bin/usb_raw_bulk.rs is henrik_alser's
i wrote https://github.com/embassy-rs/embassy/blob/main/examples/stm32f4/src/bin/usb_raw.rs originally which uses control transfers which have a built in u16 "command" and "value" field, and optional buffer of data either way after that
but in embassy it's probably simpler to just make a bulk endpoint both ways and do that instead, which is what's in that first example from the application point of view you just have an async write() and async read() functions that shuttle data around, and you send/receive a slice of arbitrary length (i.e. it's framed)
though somewhat annoyingly in embassy as-is I don't think you can send like a header and then some payload and have it be part of the same trasnfer
Definitiely keep an eye on https://github.com/kevinmehall/nusb/issues/3
Adam suggested that I just use raw USB transport, rather than re-framing over COBS.
I probably want a few "transport" options, such as some kind of embedded-io-async or something "any bidi serial", in addition to "raw transport on embassy-usb".