aboutsummaryrefslogtreecommitdiff
path: root/src/bus.rs
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2023-04-27 18:23:36 +0000
committerGitHub <[email protected]>2023-04-27 18:23:36 +0000
commitc19de2984751ba6fa2972ee66cfa2a6310d5f0c1 (patch)
tree9ba8fa01994be9ef43af404cb4399854e8c6de22 /src/bus.rs
parentf4bfda345d3d18232926a87b10333a2e624f4d04 (diff)
parent9e96655757180d7fe32ebff1ed93a35a4c3cff28 (diff)
Merge pull request #63 from kbleeke/generalize-events
rework event handling to allow sending data to `Control`
Diffstat (limited to 'src/bus.rs')
-rw-r--r--src/bus.rs8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/bus.rs b/src/bus.rs
index add346b2f..e26f11120 100644
--- a/src/bus.rs
+++ b/src/bus.rs
@@ -1,11 +1,10 @@
1use core::slice;
2
3use embassy_futures::yield_now; 1use embassy_futures::yield_now;
4use embassy_time::{Duration, Timer}; 2use embassy_time::{Duration, Timer};
5use embedded_hal_1::digital::OutputPin; 3use embedded_hal_1::digital::OutputPin;
6use futures::FutureExt; 4use futures::FutureExt;
7 5
8use crate::consts::*; 6use crate::consts::*;
7use crate::slice8_mut;
9 8
10/// Custom Spi Trait that _only_ supports the bus operation of the cyw43 9/// Custom Spi Trait that _only_ supports the bus operation of the cyw43
11/// Implementors are expected to hold the CS pin low during an operation. 10/// Implementors are expected to hold the CS pin low during an operation.
@@ -327,8 +326,3 @@ fn swap16(x: u32) -> u32 {
327fn cmd_word(write: bool, incr: bool, func: u32, addr: u32, len: u32) -> u32 { 326fn cmd_word(write: bool, incr: bool, func: u32, addr: u32, len: u32) -> u32 {
328 (write as u32) << 31 | (incr as u32) << 30 | (func & 0b11) << 28 | (addr & 0x1FFFF) << 11 | (len & 0x7FF) 327 (write as u32) << 31 | (incr as u32) << 30 | (func & 0b11) << 28 | (addr & 0x1FFFF) << 11 | (len & 0x7FF)
329} 328}
330
331fn slice8_mut(x: &mut [u32]) -> &mut [u8] {
332 let len = x.len() * 4;
333 unsafe { slice::from_raw_parts_mut(x.as_mut_ptr() as _, len) }
334}