diff options
| author | Dario Nieuwenhuis <[email protected]> | 2023-07-31 01:41:12 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2023-07-31 01:41:12 +0200 |
| commit | 4999b045df4e5956733b0341795714a9214c12d3 (patch) | |
| tree | 84c40ec27c89bb4dedea30cdafbaad484bfda3cb /examples/stm32l0/src | |
| parent | d6c5c1772cf2c6099ab08675afc0fead2e50fffb (diff) | |
stm32/rng: use bind_interrupts!.
Diffstat (limited to 'examples/stm32l0/src')
| -rw-r--r-- | examples/stm32l0/src/bin/lora_lorawan.rs | 8 |
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; | |||
| 12 | use embassy_stm32::exti::{Channel, ExtiInput}; | 12 | use embassy_stm32::exti::{Channel, ExtiInput}; |
| 13 | use embassy_stm32::gpio::{Input, Level, Output, Pin, Pull, Speed}; | 13 | use embassy_stm32::gpio::{Input, Level, Output, Pin, Pull, Speed}; |
| 14 | use embassy_stm32::rng::Rng; | 14 | use embassy_stm32::rng::Rng; |
| 15 | use embassy_stm32::spi; | ||
| 16 | use embassy_stm32::time::khz; | 15 | use embassy_stm32::time::khz; |
| 16 | use embassy_stm32::{bind_interrupts, peripherals, rng, spi}; | ||
| 17 | use embassy_time::Delay; | 17 | use embassy_time::Delay; |
| 18 | use lora_phy::mod_params::*; | 18 | use lora_phy::mod_params::*; |
| 19 | use lora_phy::sx1276_7_8_9::SX1276_7_8_9; | 19 | use lora_phy::sx1276_7_8_9::SX1276_7_8_9; |
| @@ -23,6 +23,10 @@ use lorawan_device::async_device::lora_radio::LoRaRadio; | |||
| 23 | use lorawan_device::async_device::{region, Device, JoinMode}; | 23 | use lorawan_device::async_device::{region, Device, JoinMode}; |
| 24 | use {defmt_rtt as _, panic_probe as _}; | 24 | use {defmt_rtt as _, panic_probe as _}; |
| 25 | 25 | ||
| 26 | bind_interrupts!(struct Irqs { | ||
| 27 | RNG_LPUART1 => rng::InterruptHandler<peripherals::RNG>; | ||
| 28 | }); | ||
| 29 | |||
| 26 | const LORAWAN_REGION: region::Region = region::Region::EU868; // warning: set this appropriately for the region | 30 | const 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 | ||
