aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32/src/exti.rs
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2022-11-21 23:31:31 +0100
committerDario Nieuwenhuis <[email protected]>2022-11-25 21:02:06 +0100
commit1e2fb0459d8546ba658bb9fe150be5f1f537b48e (patch)
treeeb40a5027581896c7b78db58f509431ed6b11892 /embassy-stm32/src/exti.rs
parent758f5d7ea29f1df14d5ef59c82e4b7f22545d775 (diff)
Switch to async-fn-in-trait
Diffstat (limited to 'embassy-stm32/src/exti.rs')
-rw-r--r--embassy-stm32/src/exti.rs36
1 files changed, 15 insertions, 21 deletions
diff --git a/embassy-stm32/src/exti.rs b/embassy-stm32/src/exti.rs
index dca991859..f90785815 100644
--- a/embassy-stm32/src/exti.rs
+++ b/embassy-stm32/src/exti.rs
@@ -167,39 +167,33 @@ mod eh1 {
167} 167}
168#[cfg(all(feature = "unstable-traits", feature = "nightly"))] 168#[cfg(all(feature = "unstable-traits", feature = "nightly"))]
169mod eha { 169mod eha {
170 use futures::FutureExt;
171 170
172 use super::*; 171 use super::*;
173 172
174 impl<'d, T: GpioPin> embedded_hal_async::digital::Wait for ExtiInput<'d, T> { 173 impl<'d, T: GpioPin> embedded_hal_async::digital::Wait for ExtiInput<'d, T> {
175 type WaitForHighFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; 174 async fn wait_for_high(&mut self) -> Result<(), Self::Error> {
176 175 self.wait_for_high().await;
177 fn wait_for_high<'a>(&'a mut self) -> Self::WaitForHighFuture<'a> { 176 Ok(())
178 self.wait_for_high().map(Ok)
179 } 177 }
180 178
181 type WaitForLowFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; 179 async fn wait_for_low(&mut self) -> Result<(), Self::Error> {
182 180 self.wait_for_low().await;
183 fn wait_for_low<'a>(&'a mut self) -> Self::WaitForLowFuture<'a> { 181 Ok(())
184 self.wait_for_low().map(Ok)
185 } 182 }
186 183
187 type WaitForRisingEdgeFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; 184 async fn wait_for_rising_edge(&mut self) -> Result<(), Self::Error> {
188 185 self.wait_for_rising_edge().await;
189 fn wait_for_rising_edge<'a>(&'a mut self) -> Self::WaitForRisingEdgeFuture<'a> { 186 Ok(())
190 self.wait_for_rising_edge().map(Ok)
191 } 187 }
192 188
193 type WaitForFallingEdgeFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; 189 async fn wait_for_falling_edge(&mut self) -> Result<(), Self::Error> {
194 190 self.wait_for_falling_edge().await;
195 fn wait_for_falling_edge<'a>(&'a mut self) -> Self::WaitForFallingEdgeFuture<'a> { 191 Ok(())
196 self.wait_for_falling_edge().map(Ok)
197 } 192 }
198 193
199 type WaitForAnyEdgeFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; 194 async fn wait_for_any_edge(&mut self) -> Result<(), Self::Error> {
200 195 self.wait_for_any_edge().await;
201 fn wait_for_any_edge<'a>(&'a mut self) -> Self::WaitForAnyEdgeFuture<'a> { 196 Ok(())
202 self.wait_for_any_edge().map(Ok)
203 } 197 }
204 } 198 }
205} 199}