Merge pull request #1606 from JcBernack/rng-update

STM32: RNG update
This commit is contained in:
Dario Nieuwenhuis
2023-07-30 23:44:11 +00:00
committed by GitHub
16 changed files with 192 additions and 111 deletions

View File

@ -12,8 +12,8 @@ use embassy_lora::LoraTimer;
use embassy_stm32::exti::{Channel, ExtiInput};
use embassy_stm32::gpio::{Input, Level, Output, Pin, Pull, Speed};
use embassy_stm32::rng::Rng;
use embassy_stm32::spi;
use embassy_stm32::time::khz;
use embassy_stm32::{bind_interrupts, peripherals, rng, spi};
use embassy_time::Delay;
use lora_phy::mod_params::*;
use lora_phy::sx1276_7_8_9::SX1276_7_8_9;
@ -23,6 +23,10 @@ use lorawan_device::async_device::lora_radio::LoRaRadio;
use lorawan_device::async_device::{region, Device, JoinMode};
use {defmt_rtt as _, panic_probe as _};
bind_interrupts!(struct Irqs {
RNG_LPUART1 => rng::InterruptHandler<peripherals::RNG>;
});
const LORAWAN_REGION: region::Region = region::Region::EU868; // warning: set this appropriately for the region
#[embassy_executor::main]
@ -60,7 +64,7 @@ async fn main(_spawner: Spawner) {
let radio = LoRaRadio::new(lora);
let region: region::Configuration = region::Configuration::new(LORAWAN_REGION);
let mut device: Device<_, Crypto, _, _> = Device::new(region, radio, LoraTimer::new(), Rng::new(p.RNG));
let mut device: Device<_, Crypto, _, _> = Device::new(region, radio, LoraTimer::new(), Rng::new(p.RNG, Irqs));
defmt::info!("Joining LoRaWAN network");