aboutsummaryrefslogtreecommitdiff
path: root/embassy-usb
diff options
context:
space:
mode:
authoralexmoon <[email protected]>2022-04-12 17:51:50 -0400
committeralexmoon <[email protected]>2022-04-13 14:55:02 -0400
commit2915e858baac442e71bac4b565746401deed22bd (patch)
treec4e91cc7de6be24000b9bb39096571d5f26f39df /embassy-usb
parent7fde3abd5d7e04f6d79d325d4454d6eafabebc1f (diff)
Make Driver::disable async and fix comment
Diffstat (limited to 'embassy-usb')
-rw-r--r--embassy-usb/src/driver.rs7
-rw-r--r--embassy-usb/src/lib.rs2
2 files changed, 5 insertions, 4 deletions
diff --git a/embassy-usb/src/driver.rs b/embassy-usb/src/driver.rs
index 99610deef..cedd349fb 100644
--- a/embassy-usb/src/driver.rs
+++ b/embassy-usb/src/driver.rs
@@ -59,6 +59,9 @@ pub trait Bus {
59 type EnableFuture<'a>: Future<Output = ()> + 'a 59 type EnableFuture<'a>: Future<Output = ()> + 'a
60 where 60 where
61 Self: 'a; 61 Self: 'a;
62 type DisableFuture<'a>: Future<Output = ()> + 'a
63 where
64 Self: 'a;
62 type PollFuture<'a>: Future<Output = Event> + 'a 65 type PollFuture<'a>: Future<Output = Event> + 'a
63 where 66 where
64 Self: 'a; 67 Self: 'a;
@@ -71,7 +74,7 @@ pub trait Bus {
71 fn enable(&mut self) -> Self::EnableFuture<'_>; 74 fn enable(&mut self) -> Self::EnableFuture<'_>;
72 75
73 /// Disables and powers down the USB peripheral. 76 /// Disables and powers down the USB peripheral.
74 fn disable(&mut self); 77 fn disable(&mut self) -> Self::DisableFuture<'_>;
75 78
76 fn poll<'a>(&'a mut self) -> Self::PollFuture<'a>; 79 fn poll<'a>(&'a mut self) -> Self::PollFuture<'a>;
77 80
@@ -103,8 +106,6 @@ pub trait Bus {
103 106
104 /// Initiates a remote wakeup of the host by the device. 107 /// Initiates a remote wakeup of the host by the device.
105 /// 108 ///
106 /// The default implementation just returns `Unsupported`.
107 ///
108 /// # Errors 109 /// # Errors
109 /// 110 ///
110 /// * [`Unsupported`](crate::UsbError::Unsupported) - This UsbBus implementation doesn't support 111 /// * [`Unsupported`](crate::UsbError::Unsupported) - This UsbBus implementation doesn't support
diff --git a/embassy-usb/src/lib.rs b/embassy-usb/src/lib.rs
index 210908c2c..11561430b 100644
--- a/embassy-usb/src/lib.rs
+++ b/embassy-usb/src/lib.rs
@@ -198,7 +198,7 @@ impl<'d, D: Driver<'d>, M: RawMutex> UsbDevice<'d, D, M> {
198 DeviceCommand::Enable => warn!("usb: Enable command received while enabled."), 198 DeviceCommand::Enable => warn!("usb: Enable command received while enabled."),
199 DeviceCommand::Disable => { 199 DeviceCommand::Disable => {
200 trace!("usb: disable"); 200 trace!("usb: disable");
201 self.bus.disable(); 201 self.bus.disable().await;
202 self.device_state = UsbDeviceState::Disabled; 202 self.device_state = UsbDeviceState::Disabled;
203 if let Some(h) = &self.handler { 203 if let Some(h) = &self.handler {
204 h.disabled(); 204 h.disabled();