Update for rust-lorawan and lora-phy version 2.
This commit is contained in:
@ -17,7 +17,7 @@ embassy-net-wiznet = { version = "0.1.0", path = "../../embassy-net-wiznet", fea
|
||||
embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
|
||||
embassy-usb-logger = { version = "0.1.0", path = "../../embassy-usb-logger" }
|
||||
embassy-lora = { version = "0.1.0", path = "../../embassy-lora", features = ["time", "defmt"] }
|
||||
lora-phy = { version = "1" }
|
||||
lora-phy = { version = "2" }
|
||||
lorawan-device = { version = "0.10.0", default-features = false, features = ["async", "external-lora-phy"] }
|
||||
lorawan = { version = "0.7.3", default-features = false, features = ["default-crypto"] }
|
||||
cyw43 = { path = "../../cyw43", features = ["defmt", "firmware-logs"] }
|
||||
@ -57,4 +57,5 @@ rand = { version = "0.8.5", default-features = false }
|
||||
debug = 2
|
||||
|
||||
[patch.crates-io]
|
||||
lora-phy = { git = "https://github.com/embassy-rs/lora-phy", rev = "1323eccc1c470d4259f95f4f315d1be830d572a3"}
|
||||
lorawan-device = { git = "https://github.com/ivajloip/rust-lorawan", rev = "b0502c1a802427638cc8bcd928fc632d13b778b6"}
|
||||
lorawan = { git = "https://github.com/ivajloip/rust-lorawan", rev = "b0502c1a802427638cc8bcd928fc632d13b778b6"}
|
||||
|
@ -19,6 +19,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 _};
|
||||
|
||||
const LORAWAN_REGION: region::Region = region::Region::EU868; // warning: set this appropriately for the region
|
||||
@ -39,16 +40,8 @@ async fn main(_spawner: Spawner) {
|
||||
|
||||
let iv = GenericSx126xInterfaceVariant::new(nss, reset, dio1, busy, None, None).unwrap();
|
||||
|
||||
let mut delay = Delay;
|
||||
|
||||
let lora = {
|
||||
match LoRa::new(
|
||||
SX1261_2::new(BoardType::RpPicoWaveshareSx1262, spi, iv),
|
||||
true,
|
||||
&mut delay,
|
||||
)
|
||||
.await
|
||||
{
|
||||
match LoRa::new(SX1261_2::new(BoardType::RpPicoWaveshareSx1262, spi, iv), true, Delay).await {
|
||||
Ok(l) => l,
|
||||
Err(err) => {
|
||||
info!("Radio error = {}", err);
|
||||
@ -66,9 +59,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
|
||||
{
|
||||
|
@ -35,16 +35,8 @@ async fn main(_spawner: Spawner) {
|
||||
|
||||
let iv = GenericSx126xInterfaceVariant::new(nss, reset, dio1, busy, None, None).unwrap();
|
||||
|
||||
let mut delay = Delay;
|
||||
|
||||
let mut lora = {
|
||||
match LoRa::new(
|
||||
SX1261_2::new(BoardType::RpPicoWaveshareSx1262, spi, iv),
|
||||
false,
|
||||
&mut delay,
|
||||
)
|
||||
.await
|
||||
{
|
||||
match LoRa::new(SX1261_2::new(BoardType::RpPicoWaveshareSx1262, spi, iv), false, Delay).await {
|
||||
Ok(l) => l,
|
||||
Err(err) => {
|
||||
info!("Radio error = {}", err);
|
||||
@ -83,7 +75,7 @@ async fn main(_spawner: Spawner) {
|
||||
};
|
||||
|
||||
match lora
|
||||
.prepare_for_rx(&mdltn_params, &rx_pkt_params, None, true, false, 0, 0x00ffffffu32)
|
||||
.prepare_for_rx(&mdltn_params, &rx_pkt_params, None, None, false)
|
||||
.await
|
||||
{
|
||||
Ok(()) => {}
|
||||
|
@ -35,16 +35,8 @@ async fn main(_spawner: Spawner) {
|
||||
|
||||
let iv = GenericSx126xInterfaceVariant::new(nss, reset, dio1, busy, None, None).unwrap();
|
||||
|
||||
let mut delay = Delay;
|
||||
|
||||
let mut lora = {
|
||||
match LoRa::new(
|
||||
SX1261_2::new(BoardType::RpPicoWaveshareSx1262, spi, iv),
|
||||
false,
|
||||
&mut delay,
|
||||
)
|
||||
.await
|
||||
{
|
||||
match LoRa::new(SX1261_2::new(BoardType::RpPicoWaveshareSx1262, spi, iv), false, Delay).await {
|
||||
Ok(l) => l,
|
||||
Err(err) => {
|
||||
info!("Radio error = {}", err);
|
||||
@ -97,7 +89,7 @@ async fn main(_spawner: Spawner) {
|
||||
}
|
||||
};
|
||||
|
||||
match lora.sleep(&mut delay).await {
|
||||
match lora.sleep(false).await {
|
||||
Ok(()) => info!("Sleep successful"),
|
||||
Err(err) => info!("Sleep unsuccessful = {}", err),
|
||||
}
|
||||
|
@ -69,16 +69,9 @@ async fn core1_task(
|
||||
iv: GenericSx126xInterfaceVariant<Output<'static, AnyPin>, Input<'static, AnyPin>>,
|
||||
) {
|
||||
info!("Hello from core 1");
|
||||
let mut delay = Delay;
|
||||
|
||||
let mut lora = {
|
||||
match LoRa::new(
|
||||
SX1261_2::new(BoardType::RpPicoWaveshareSx1262, spi, iv),
|
||||
false,
|
||||
&mut delay,
|
||||
)
|
||||
.await
|
||||
{
|
||||
match LoRa::new(SX1261_2::new(BoardType::RpPicoWaveshareSx1262, spi, iv), false, Delay).await {
|
||||
Ok(l) => l,
|
||||
Err(err) => {
|
||||
info!("Radio error = {}", err);
|
||||
@ -132,7 +125,7 @@ async fn core1_task(
|
||||
}
|
||||
};
|
||||
|
||||
match lora.sleep(&mut delay).await {
|
||||
match lora.sleep(false).await {
|
||||
Ok(()) => info!("Sleep successful"),
|
||||
Err(err) => info!("Sleep unsuccessful = {}", err),
|
||||
}
|
||||
|
Reference in New Issue
Block a user