From 460cdc9e0f51979e27dbd0a8faaad2738760cdf3 Mon Sep 17 00:00:00 2001 From: Ben Simms Date: Thu, 13 Jul 2023 19:29:09 +0100 Subject: [PATCH] Check intrstatus before signalling suspended --- embassy-rp/src/usb.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/embassy-rp/src/usb.rs b/embassy-rp/src/usb.rs index b3f3bd92..4ab881f6 100644 --- a/embassy-rp/src/usb.rs +++ b/embassy-rp/src/usb.rs @@ -361,6 +361,7 @@ impl<'d, T: Instance> driver::Bus for Bus<'d, T> { let regs = T::regs(); let siestatus = regs.sie_status().read(); + let intrstatus = regs.intr().read(); if siestatus.resume() { regs.sie_status().write(|w| w.set_resume(true)); @@ -389,7 +390,7 @@ impl<'d, T: Instance> driver::Bus for Bus<'d, T> { return Poll::Ready(Event::Reset); } - if siestatus.suspended() { + if siestatus.suspended() && intrstatus.dev_suspend() { regs.sie_status().write(|w| w.set_suspended(true)); return Poll::Ready(Event::Suspend); }