diff options
| author | Dario Nieuwenhuis <[email protected]> | 2022-01-13 20:00:33 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2022-01-13 23:56:39 +0100 |
| commit | a287fef687b47edc57e17131e3d663cd860ad471 (patch) | |
| tree | f2d3b0b55d568eaee70f1714c485b3b0e77ecb18 /examples/nrf/src | |
| parent | 7086642ce43de7c2fe476da94ec53ed6282087ec (diff) | |
nrf/spim: expose all functionality as inherent methods.
Diffstat (limited to 'examples/nrf/src')
| -rw-r--r-- | examples/nrf/src/bin/spim.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/examples/nrf/src/bin/spim.rs b/examples/nrf/src/bin/spim.rs index fc31d140a..cda3baa26 100644 --- a/examples/nrf/src/bin/spim.rs +++ b/examples/nrf/src/bin/spim.rs | |||
| @@ -9,7 +9,6 @@ use embassy::executor::Spawner; | |||
| 9 | use embassy_nrf::gpio::{Level, Output, OutputDrive}; | 9 | use embassy_nrf::gpio::{Level, Output, OutputDrive}; |
| 10 | use embassy_nrf::Peripherals; | 10 | use embassy_nrf::Peripherals; |
| 11 | use embassy_nrf::{interrupt, spim}; | 11 | use embassy_nrf::{interrupt, spim}; |
| 12 | use embassy_traits::spi::FullDuplex; | ||
| 13 | use example_common::*; | 12 | use example_common::*; |
| 14 | 13 | ||
| 15 | #[embassy::main] | 14 | #[embassy::main] |
| @@ -31,7 +30,7 @@ async fn main(_spawner: Spawner, p: Peripherals) { | |||
| 31 | ncs.set_low(); | 30 | ncs.set_low(); |
| 32 | cortex_m::asm::delay(5); | 31 | cortex_m::asm::delay(5); |
| 33 | let tx = [0xFF]; | 32 | let tx = [0xFF]; |
| 34 | unwrap!(spim.read_write(&mut [], &tx).await); | 33 | unwrap!(spim.transfer(&mut [], &tx).await); |
| 35 | cortex_m::asm::delay(10); | 34 | cortex_m::asm::delay(10); |
| 36 | ncs.set_high(); | 35 | ncs.set_high(); |
| 37 | 36 | ||
| @@ -44,7 +43,7 @@ async fn main(_spawner: Spawner, p: Peripherals) { | |||
| 44 | ncs.set_low(); | 43 | ncs.set_low(); |
| 45 | cortex_m::asm::delay(5000); | 44 | cortex_m::asm::delay(5000); |
| 46 | let tx = [0b000_11101, 0]; | 45 | let tx = [0b000_11101, 0]; |
| 47 | unwrap!(spim.read_write(&mut rx, &tx).await); | 46 | unwrap!(spim.transfer(&mut rx, &tx).await); |
| 48 | cortex_m::asm::delay(5000); | 47 | cortex_m::asm::delay(5000); |
| 49 | ncs.set_high(); | 48 | ncs.set_high(); |
| 50 | info!("estat: {=[?]}", rx); | 49 | info!("estat: {=[?]}", rx); |
| @@ -54,7 +53,7 @@ async fn main(_spawner: Spawner, p: Peripherals) { | |||
| 54 | ncs.set_low(); | 53 | ncs.set_low(); |
| 55 | cortex_m::asm::delay(5); | 54 | cortex_m::asm::delay(5); |
| 56 | let tx = [0b100_11111, 0b11]; | 55 | let tx = [0b100_11111, 0b11]; |
| 57 | unwrap!(spim.read_write(&mut rx, &tx).await); | 56 | unwrap!(spim.transfer(&mut rx, &tx).await); |
| 58 | cortex_m::asm::delay(10); | 57 | cortex_m::asm::delay(10); |
| 59 | ncs.set_high(); | 58 | ncs.set_high(); |
| 60 | 59 | ||
| @@ -63,7 +62,7 @@ async fn main(_spawner: Spawner, p: Peripherals) { | |||
| 63 | ncs.set_low(); | 62 | ncs.set_low(); |
| 64 | cortex_m::asm::delay(5); | 63 | cortex_m::asm::delay(5); |
| 65 | let tx = [0b000_10010, 0]; | 64 | let tx = [0b000_10010, 0]; |
| 66 | unwrap!(spim.read_write(&mut rx, &tx).await); | 65 | unwrap!(spim.transfer(&mut rx, &tx).await); |
| 67 | cortex_m::asm::delay(10); | 66 | cortex_m::asm::delay(10); |
| 68 | ncs.set_high(); | 67 | ncs.set_high(); |
| 69 | 68 | ||
