diff options
| author | Ulf Lilleengen <[email protected]> | 2021-12-01 21:59:53 +0100 |
|---|---|---|
| committer | Ulf Lilleengen <[email protected]> | 2021-12-03 09:53:28 +0100 |
| commit | 9a730ef692d2b5c529f5e1aac58e80c6d04c2458 (patch) | |
| tree | 61f0c496bdff598b017c0597c60c6c0a13c5373d /examples | |
| parent | b9693c0b9158159822e97a9f34745353b32a3bf2 (diff) | |
Refactor sx127x radio to use async SPI with DMA
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/stm32l0/Cargo.toml | 2 | ||||
| -rw-r--r-- | examples/stm32l0/src/bin/lorawan.rs | 17 |
2 files changed, 6 insertions, 13 deletions
diff --git a/examples/stm32l0/Cargo.toml b/examples/stm32l0/Cargo.toml index 6d840d503..53ba6ba39 100644 --- a/examples/stm32l0/Cargo.toml +++ b/examples/stm32l0/Cargo.toml | |||
| @@ -20,7 +20,7 @@ defmt-rtt = "0.3" | |||
| 20 | 20 | ||
| 21 | cortex-m = "0.7.3" | 21 | cortex-m = "0.7.3" |
| 22 | cortex-m-rt = "0.7.0" | 22 | cortex-m-rt = "0.7.0" |
| 23 | embedded-hal = "0.2.6" | ||
| 24 | panic-probe = { version = "0.3", features = ["print-defmt"] } | 23 | panic-probe = { version = "0.3", features = ["print-defmt"] } |
| 25 | futures = { version = "0.3.17", default-features = false, features = ["async-await"] } | 24 | futures = { version = "0.3.17", default-features = false, features = ["async-await"] } |
| 26 | heapless = { version = "0.7.5", default-features = false } | 25 | heapless = { version = "0.7.5", default-features = false } |
| 26 | embedded-hal = "0.2.6" | ||
diff --git a/examples/stm32l0/src/bin/lorawan.rs b/examples/stm32l0/src/bin/lorawan.rs index 5ca69f9a7..cbae88356 100644 --- a/examples/stm32l0/src/bin/lorawan.rs +++ b/examples/stm32l0/src/bin/lorawan.rs | |||
| @@ -12,7 +12,6 @@ mod example_common; | |||
| 12 | use embassy_lora::{sx127x::*, LoraTimer}; | 12 | use embassy_lora::{sx127x::*, LoraTimer}; |
| 13 | use embassy_stm32::{ | 13 | use embassy_stm32::{ |
| 14 | dbgmcu::Dbgmcu, | 14 | dbgmcu::Dbgmcu, |
| 15 | dma::NoDma, | ||
| 16 | exti::ExtiInput, | 15 | exti::ExtiInput, |
| 17 | gpio::{Input, Level, Output, Pull, Speed}, | 16 | gpio::{Input, Level, Output, Pull, Speed}, |
| 18 | rcc, | 17 | rcc, |
| @@ -45,8 +44,8 @@ async fn main(_spawner: embassy::executor::Spawner, mut p: Peripherals) { | |||
| 45 | p.PB3, | 44 | p.PB3, |
| 46 | p.PA7, | 45 | p.PA7, |
| 47 | p.PA6, | 46 | p.PA6, |
| 48 | NoDma, | 47 | p.DMA1_CH3, |
| 49 | NoDma, | 48 | p.DMA1_CH2, |
| 50 | 200_000.hz(), | 49 | 200_000.hz(), |
| 51 | spi::Config::default(), | 50 | spi::Config::default(), |
| 52 | ); | 51 | ); |
| @@ -58,15 +57,9 @@ async fn main(_spawner: embassy::executor::Spawner, mut p: Peripherals) { | |||
| 58 | let ready = Input::new(p.PB4, Pull::Up); | 57 | let ready = Input::new(p.PB4, Pull::Up); |
| 59 | let ready_pin = ExtiInput::new(ready, p.EXTI4); | 58 | let ready_pin = ExtiInput::new(ready, p.EXTI4); |
| 60 | 59 | ||
| 61 | let radio = Sx127xRadio::new( | 60 | let radio = Sx127xRadio::new(spi, cs, reset, ready_pin, DummySwitch) |
| 62 | spi, | 61 | .await |
| 63 | cs, | 62 | .unwrap(); |
| 64 | reset, | ||
| 65 | ready_pin, | ||
| 66 | DummySwitch, | ||
| 67 | &mut embassy::time::Delay, | ||
| 68 | ) | ||
| 69 | .unwrap(); | ||
| 70 | 63 | ||
| 71 | let region = region::EU868::default().into(); | 64 | let region = region::EU868::default().into(); |
| 72 | let mut radio_buffer = [0; 256]; | 65 | let mut radio_buffer = [0; 256]; |
