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

@ -406,13 +406,6 @@ impl<'d, T: Instance> driver::Bus for Bus<'d, T> {
.await
}
#[inline]
fn set_address(&mut self, addr: u8) {
let regs = T::regs();
trace!("setting addr: {}", addr);
unsafe { regs.addr_endp().write(|w| w.set_address(addr)) }
}
fn endpoint_set_stalled(&mut self, _ep_addr: EndpointAddress, _stalled: bool) {
todo!();
}
@ -812,4 +805,12 @@ impl<'d, T: Instance> driver::ControlPipe for ControlPipe<'d, T> {
T::dpram().ep_in_buffer_control(0).write(|w| w.set_stall(true));
}
}
async fn accept_set_address(&mut self, addr: u8) {
self.accept().await;
let regs = T::regs();
trace!("setting addr: {}", addr);
unsafe { regs.addr_endp().write(|w| w.set_address(addr)) }
}
}