aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32l0/src
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2023-07-31 01:41:12 +0200
committerDario Nieuwenhuis <[email protected]>2023-07-31 01:41:12 +0200
commit4999b045df4e5956733b0341795714a9214c12d3 (patch)
tree84c40ec27c89bb4dedea30cdafbaad484bfda3cb /examples/stm32l0/src
parentd6c5c1772cf2c6099ab08675afc0fead2e50fffb (diff)
stm32/rng: use bind_interrupts!.
Diffstat (limited to 'examples/stm32l0/src')
-rw-r--r--examples/stm32l0/src/bin/lora_lorawan.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/examples/stm32l0/src/bin/lora_lorawan.rs b/examples/stm32l0/src/bin/lora_lorawan.rs
index c397edd58..03c793b32 100644
--- a/examples/stm32l0/src/bin/lora_lorawan.rs
+++ b/examples/stm32l0/src/bin/lora_lorawan.rs
@@ -12,8 +12,8 @@ use embassy_lora::LoraTimer;
12use embassy_stm32::exti::{Channel, ExtiInput}; 12use embassy_stm32::exti::{Channel, ExtiInput};
13use embassy_stm32::gpio::{Input, Level, Output, Pin, Pull, Speed}; 13use embassy_stm32::gpio::{Input, Level, Output, Pin, Pull, Speed};
14use embassy_stm32::rng::Rng; 14use embassy_stm32::rng::Rng;
15use embassy_stm32::spi;
16use embassy_stm32::time::khz; 15use embassy_stm32::time::khz;
16use embassy_stm32::{bind_interrupts, peripherals, rng, spi};
17use embassy_time::Delay; 17use embassy_time::Delay;
18use lora_phy::mod_params::*; 18use lora_phy::mod_params::*;
19use lora_phy::sx1276_7_8_9::SX1276_7_8_9; 19use lora_phy::sx1276_7_8_9::SX1276_7_8_9;
@@ -23,6 +23,10 @@ use lorawan_device::async_device::lora_radio::LoRaRadio;
23use lorawan_device::async_device::{region, Device, JoinMode}; 23use lorawan_device::async_device::{region, Device, JoinMode};
24use {defmt_rtt as _, panic_probe as _}; 24use {defmt_rtt as _, panic_probe as _};
25 25
26bind_interrupts!(struct Irqs {
27 RNG_LPUART1 => rng::InterruptHandler<peripherals::RNG>;
28});
29
26const LORAWAN_REGION: region::Region = region::Region::EU868; // warning: set this appropriately for the region 30const LORAWAN_REGION: region::Region = region::Region::EU868; // warning: set this appropriately for the region
27 31
28#[embassy_executor::main] 32#[embassy_executor::main]
@@ -66,7 +70,7 @@ async fn main(_spawner: Spawner) {
66 70
67 let radio = LoRaRadio::new(lora); 71 let radio = LoRaRadio::new(lora);
68 let region: region::Configuration = region::Configuration::new(LORAWAN_REGION); 72 let region: region::Configuration = region::Configuration::new(LORAWAN_REGION);
69 let mut device: Device<_, Crypto, _, _> = Device::new(region, radio, LoraTimer::new(), Rng::new(p.RNG)); 73 let mut device: Device<_, Crypto, _, _> = Device::new(region, radio, LoraTimer::new(), Rng::new(p.RNG, Irqs));
70 74
71 defmt::info!("Joining LoRaWAN network"); 75 defmt::info!("Joining LoRaWAN network");
72 76