aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-rp/src/usb.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/embassy-rp/src/usb.rs b/embassy-rp/src/usb.rs
index 0a904aab3..7a83dcb4a 100644
--- a/embassy-rp/src/usb.rs
+++ b/embassy-rp/src/usb.rs
@@ -811,8 +811,8 @@ impl<'d, T: Instance> driver::ControlPipe for ControlPipe<'d, T> {
811 async move { 811 async move {
812 trace!("control: accept"); 812 trace!("control: accept");
813 813
814 let bufcontrol = T::dpram().ep_in_buffer_control(0);
814 unsafe { 815 unsafe {
815 let bufcontrol = T::dpram().ep_in_buffer_control(0);
816 bufcontrol.write(|w| { 816 bufcontrol.write(|w| {
817 w.set_length(0, 0); 817 w.set_length(0, 0);
818 w.set_pid(0, true); 818 w.set_pid(0, true);
@@ -826,6 +826,18 @@ impl<'d, T: Instance> driver::ControlPipe for ControlPipe<'d, T> {
826 w.set_available(0, true); 826 w.set_available(0, true);
827 }); 827 });
828 } 828 }
829
830 // wait for completion before returning, needed so
831 // set_address() doesn't happen early.
832 poll_fn(|cx| {
833 EP_IN_WAKERS[0].register(cx.waker());
834 if unsafe { bufcontrol.read().available(0) } {
835 Poll::Pending
836 } else {
837 Poll::Ready(())
838 }
839 })
840 .await;
829 } 841 }
830 } 842 }
831 843