diff options
| author | kbleeke <[email protected]> | 2023-03-27 14:37:39 +0200 |
|---|---|---|
| committer | kbleeke <[email protected]> | 2023-03-27 15:29:01 +0200 |
| commit | 8926397f4592f22a5ed54f772a979578ca36628f (patch) | |
| tree | 44ea2747d84c57dc021e141f9ffe03bf4b911738 /src/bus.rs | |
| parent | b58cc2aa239e4adba2c32462cc89133bb7d9f698 (diff) | |
address irq nits
Diffstat (limited to 'src/bus.rs')
| -rw-r--r-- | src/bus.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/bus.rs b/src/bus.rs index 6ec5d0bd6..d2a249f97 100644 --- a/src/bus.rs +++ b/src/bus.rs | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | use core::slice; | 1 | use core::slice; |
| 2 | 2 | ||
| 3 | use embassy_futures::yield_now; | ||
| 3 | use embassy_time::{Duration, Timer}; | 4 | use embassy_time::{Duration, Timer}; |
| 4 | use embedded_hal_1::digital::OutputPin; | 5 | use embedded_hal_1::digital::OutputPin; |
| 5 | use futures::FutureExt; | 6 | use futures::FutureExt; |
| @@ -20,8 +21,11 @@ pub trait SpiBusCyw43 { | |||
| 20 | /// Callers that want to read `n` word from the backplane, have to provide a slice that is `n+1` words long. | 21 | /// Callers that want to read `n` word from the backplane, have to provide a slice that is `n+1` words long. |
| 21 | async fn cmd_read(&mut self, write: u32, read: &mut [u32]); | 22 | async fn cmd_read(&mut self, write: u32, read: &mut [u32]); |
| 22 | 23 | ||
| 23 | async fn wait_for_event(&mut self); | 24 | /// Wait for events from the Device. A typical implementation would wait for the IRQ pin to be high. |
| 24 | fn clear_event(&mut self); | 25 | /// The default implementation always reports ready, resulting in active polling of the device. |
| 26 | async fn wait_for_event(&mut self) { | ||
| 27 | yield_now().await; | ||
| 28 | } | ||
| 25 | } | 29 | } |
| 26 | 30 | ||
| 27 | pub(crate) struct Bus<PWR, SPI> { | 31 | pub(crate) struct Bus<PWR, SPI> { |
| @@ -305,10 +309,6 @@ where | |||
| 305 | pub async fn wait_for_event(&mut self) { | 309 | pub async fn wait_for_event(&mut self) { |
| 306 | self.spi.wait_for_event().await; | 310 | self.spi.wait_for_event().await; |
| 307 | } | 311 | } |
| 308 | |||
| 309 | pub fn clear_event(&mut self) { | ||
| 310 | self.spi.clear_event(); | ||
| 311 | } | ||
| 312 | } | 312 | } |
| 313 | 313 | ||
| 314 | fn swap16(x: u32) -> u32 { | 314 | fn swap16(x: u32) -> u32 { |
