rust-embedded-community / usb-device

Experimental device-side USB framework for microcontrollers in Rust.
MIT License
414 stars 77 forks source link

Add methods to make descriptor writing more flexible #64

Closed mvirkkunen closed 2 years ago

mvirkkunen commented 3 years ago

Adds a method for writing descriptors with an unknown length in a way that's similar to how accepting control transfers works, and a method for writing endpoint descriptors with extra data in the same manner.

Unfortunately the naming is the reverse of control transfers (write_with takes a callback while accept_with takes a buffer), but this way it's compatible.

This would implement both #63 and #46. @Windfisch, if you have an audio driver going, could you test this to see if it's good for your purposes?

Windfisch commented 3 years ago

Hey @mvirkkunen, thank you for your effort! This PR works fine for me (though I still need to manually merge in #62 to support larger descriptors ;)). I also think that the interface is nice to use, so I'm fine :).

Windfisch commented 2 years ago

@mvirkkunen care to click "merge" on this?