Update for rust-lorawan and lora-phy version 2.

This commit is contained in:
ceekdee
2023-09-24 10:33:03 -05:00
parent 65d36f9f99
commit 7d5e62d4a7
21 changed files with 56 additions and 105 deletions

View File

@ -21,6 +21,7 @@ use lora_phy::LoRa;
use lorawan::default_crypto::DefaultFactory as Crypto;
use lorawan_device::async_device::lora_radio::LoRaRadio;
use lorawan_device::async_device::{region, Device, JoinMode};
use lorawan_device::{AppEui, AppKey, DevEui};
use {defmt_rtt as _, panic_probe as _};
bind_interrupts!(struct Irqs {
@ -50,10 +51,8 @@ async fn main(_spawner: Spawner) {
let iv = Stm32l0InterfaceVariant::new(nss, reset, irq, None, None).unwrap();
let mut delay = Delay;
let lora = {
match LoRa::new(SX1276_7_8_9::new(BoardType::Stm32l0Sx1276, spi, iv), true, &mut delay).await {
match LoRa::new(SX1276_7_8_9::new(BoardType::Stm32l0Sx1276, spi, iv), true, Delay).await {
Ok(l) => l,
Err(err) => {
info!("Radio error = {}", err);
@ -71,9 +70,9 @@ async fn main(_spawner: Spawner) {
// TODO: Adjust the EUI and Keys according to your network credentials
match device
.join(&JoinMode::OTAA {
deveui: [0, 0, 0, 0, 0, 0, 0, 0],
appeui: [0, 0, 0, 0, 0, 0, 0, 0],
appkey: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
deveui: DevEui::from([0, 0, 0, 0, 0, 0, 0, 0]),
appeui: AppEui::from([0, 0, 0, 0, 0, 0, 0, 0]),
appkey: AppKey::from([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
})
.await
{