Refactor embassy-usb address handling to allow reordering of status resoponse

This commit is contained in:
chemicstry
2023-01-11 17:47:12 +01:00
committed by Dario Nieuwenhuis
parent 96b97c4711
commit ce842fe28c
5 changed files with 44 additions and 38 deletions

View File

@ -164,9 +164,6 @@ pub trait Bus {
async fn poll(&mut self) -> Event;
/// Sets the device USB address to `addr`.
fn set_address(&mut self, addr: u8);
/// Enables or disables an endpoint.
fn endpoint_set_enabled(&mut self, ep_addr: EndpointAddress, enabled: bool);
@ -306,6 +303,12 @@ pub trait ControlPipe {
///
/// Sets a STALL condition on the pipe to indicate an error.
async fn reject(&mut self);
/// Accept SET_ADDRESS control and change bus address.
///
/// For most drivers this function should firstly call `accept()` and then change the bus address.
/// However, there are peripherals (Synopsys USB OTG) that have reverse order.
async fn accept_set_address(&mut self, addr: u8);
}
pub trait EndpointIn: Endpoint {