diff options
Diffstat (limited to 'src/bus.rs')
| -rw-r--r-- | src/bus.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/bus.rs b/src/bus.rs index 7700a832a..6ec5d0bd6 100644 --- a/src/bus.rs +++ b/src/bus.rs | |||
| @@ -19,6 +19,9 @@ pub trait SpiBusCyw43 { | |||
| 19 | /// Backplane reads have a response delay that produces one extra unspecified word at the beginning of `read`. | 19 | /// Backplane reads have a response delay that produces one extra unspecified word at the beginning of `read`. |
| 20 | /// Callers that want to read `n` word from the backplane, have to provide a slice that is `n+1` words long. | 20 | /// 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]); | 21 | async fn cmd_read(&mut self, write: u32, read: &mut [u32]); |
| 22 | |||
| 23 | async fn wait_for_event(&mut self); | ||
| 24 | fn clear_event(&mut self); | ||
| 22 | } | 25 | } |
| 23 | 26 | ||
| 24 | pub(crate) struct Bus<PWR, SPI> { | 27 | pub(crate) struct Bus<PWR, SPI> { |
| @@ -63,7 +66,8 @@ where | |||
| 63 | trace!("{:#010b}", (val & 0xff)); | 66 | trace!("{:#010b}", (val & 0xff)); |
| 64 | 67 | ||
| 65 | // 32-bit word length, little endian (which is the default endianess). | 68 | // 32-bit word length, little endian (which is the default endianess). |
| 66 | self.write32_swapped(REG_BUS_CTRL, WORD_LENGTH_32 | HIGH_SPEED).await; | 69 | self.write32_swapped(REG_BUS_CTRL, WORD_LENGTH_32 | HIGH_SPEED | INTERRUPT_HIGH | WAKE_UP) |
| 70 | .await; | ||
| 67 | 71 | ||
| 68 | let val = self.read8(FUNC_BUS, REG_BUS_CTRL).await; | 72 | let val = self.read8(FUNC_BUS, REG_BUS_CTRL).await; |
| 69 | trace!("{:#b}", val); | 73 | trace!("{:#b}", val); |
| @@ -297,6 +301,14 @@ where | |||
| 297 | 301 | ||
| 298 | self.spi.cmd_write(&buf).await; | 302 | self.spi.cmd_write(&buf).await; |
| 299 | } | 303 | } |
| 304 | |||
| 305 | pub async fn wait_for_event(&mut self) { | ||
| 306 | self.spi.wait_for_event().await; | ||
| 307 | } | ||
| 308 | |||
| 309 | pub fn clear_event(&mut self) { | ||
| 310 | self.spi.clear_event(); | ||
| 311 | } | ||
| 300 | } | 312 | } |
| 301 | 313 | ||
| 302 | fn swap16(x: u32) -> u32 { | 314 | fn swap16(x: u32) -> u32 { |
