aboutsummaryrefslogtreecommitdiff
path: root/src/bus.rs
diff options
context:
space:
mode:
authorkbleeke <[email protected]>2023-03-27 14:37:39 +0200
committerkbleeke <[email protected]>2023-03-27 15:29:01 +0200
commit8926397f4592f22a5ed54f772a979578ca36628f (patch)
tree44ea2747d84c57dc021e141f9ffe03bf4b911738 /src/bus.rs
parentb58cc2aa239e4adba2c32462cc89133bb7d9f698 (diff)
address irq nits
Diffstat (limited to 'src/bus.rs')
-rw-r--r--src/bus.rs12
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 @@
1use core::slice; 1use core::slice;
2 2
3use embassy_futures::yield_now;
3use embassy_time::{Duration, Timer}; 4use embassy_time::{Duration, Timer};
4use embedded_hal_1::digital::OutputPin; 5use embedded_hal_1::digital::OutputPin;
5use futures::FutureExt; 6use 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
27pub(crate) struct Bus<PWR, SPI> { 31pub(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
314fn swap16(x: u32) -> u32 { 314fn swap16(x: u32) -> u32 {