aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-12-06 08:35:11 +0000
committerGitHub <[email protected]>2021-12-06 08:35:11 +0000
commit7c155c3abaee8aea32896e20ce14bce6efa1eb1b (patch)
treef8b664399b29b8c988472599e6c399092ff75369 /examples
parent6d6e6f55b8a9ecd38b5a6d3bb11f74b2654afdeb (diff)
parent81ec4c82fdd89798edc1eda764017b5e81184401 (diff)
Merge #514
514: Refactor sx127x driver to use async SPI r=lulf a=lulf It also contains a fix to SPI DMA transfer/read_write operations to ensure MISO doesn't contain any old data. Co-authored-by: Ulf Lilleengen <[email protected]>
Diffstat (limited to 'examples')
-rw-r--r--examples/stm32l0/Cargo.toml9
-rw-r--r--examples/stm32l0/src/bin/lorawan.rs17
-rw-r--r--examples/stm32wl55/Cargo.toml4
3 files changed, 12 insertions, 18 deletions
diff --git a/examples/stm32l0/Cargo.toml b/examples/stm32l0/Cargo.toml
index 6fe744f03..53ba6ba39 100644
--- a/examples/stm32l0/Cargo.toml
+++ b/examples/stm32l0/Cargo.toml
@@ -10,16 +10,17 @@ embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt"] }
10embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] } 10embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] }
11embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32l072cz", "time-driver-tim3"] } 11embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32l072cz", "time-driver-tim3"] }
12 12
13embassy-lora = { version = "0.1.0", path = "../../embassy-lora", features = ["sx127x", "time"] } 13embassy-lora = { version = "0.1.0", path = "../../embassy-lora", features = ["sx127x", "time", "defmt"] }
14lorawan-device = { git = "https://github.com/ivajloip/rust-lorawan.git", rev = "4bff2e0021103adfbccedcbf49dbcd0474adc4b2", default-features = false, features = ["async"] } 14
15lorawan-encoding = { git = "https://github.com/ivajloip/rust-lorawan.git", rev = "4bff2e0021103adfbccedcbf49dbcd0474adc4b2", default-features = false, features = ["default-crypto"] } 15lorawan-device = { git = "https://github.com/ivajloip/rust-lorawan.git", rev = "53d2feb43e2f3ddcdc55f0587391b0d3f02d8d93", default-features = false, features = ["async"] }
16lorawan-encoding = { git = "https://github.com/ivajloip/rust-lorawan.git", rev = "53d2feb43e2f3ddcdc55f0587391b0d3f02d8d93", default-features = false, features = ["default-crypto"] }
16 17
17defmt = "0.3" 18defmt = "0.3"
18defmt-rtt = "0.3" 19defmt-rtt = "0.3"
19 20
20cortex-m = "0.7.3" 21cortex-m = "0.7.3"
21cortex-m-rt = "0.7.0" 22cortex-m-rt = "0.7.0"
22embedded-hal = "0.2.6"
23panic-probe = { version = "0.3", features = ["print-defmt"] } 23panic-probe = { version = "0.3", features = ["print-defmt"] }
24futures = { version = "0.3.17", default-features = false, features = ["async-await"] } 24futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
25heapless = { version = "0.7.5", default-features = false } 25heapless = { version = "0.7.5", default-features = false }
26embedded-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;
12use embassy_lora::{sx127x::*, LoraTimer}; 12use embassy_lora::{sx127x::*, LoraTimer};
13use embassy_stm32::{ 13use 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];
diff --git a/examples/stm32wl55/Cargo.toml b/examples/stm32wl55/Cargo.toml
index 7a7621230..c7344152d 100644
--- a/examples/stm32wl55/Cargo.toml
+++ b/examples/stm32wl55/Cargo.toml
@@ -11,8 +11,8 @@ embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features =
11embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32wl55jc-cm4", "time-driver-tim2", "memory-x", "subghz", "unstable-pac"] } 11embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32wl55jc-cm4", "time-driver-tim2", "memory-x", "subghz", "unstable-pac"] }
12embassy-lora = { version = "0.1.0", path = "../../embassy-lora", features = ["stm32wl", "time"] } 12embassy-lora = { version = "0.1.0", path = "../../embassy-lora", features = ["stm32wl", "time"] }
13 13
14lorawan-device = { git = "https://github.com/ivajloip/rust-lorawan.git", rev = "4bff2e0021103adfbccedcbf49dbcd0474adc4b2", default-features = false, features = ["async"] } 14lorawan-device = { git = "https://github.com/ivajloip/rust-lorawan.git", rev = "53d2feb43e2f3ddcdc55f0587391b0d3f02d8d93", default-features = false, features = ["async"] }
15lorawan-encoding = { git = "https://github.com/ivajloip/rust-lorawan.git", rev = "4bff2e0021103adfbccedcbf49dbcd0474adc4b2", default-features = false, features = ["default-crypto"] } 15lorawan-encoding = { git = "https://github.com/ivajloip/rust-lorawan.git", rev = "53d2feb43e2f3ddcdc55f0587391b0d3f02d8d93", default-features = false, features = ["default-crypto"] }
16 16
17defmt = "0.3" 17defmt = "0.3"
18defmt-rtt = "0.3" 18defmt-rtt = "0.3"