diff options
| author | Ulf Lilleengen <[email protected]> | 2023-04-14 23:01:13 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2023-04-15 01:00:12 +0200 |
| commit | 63941432e3f68a0a3f2f4e97a807bfe16f4aff2b (patch) | |
| tree | 0684d5e1cc90ede145a380fba9ab1c3212162166 | |
| parent | 224eaaf79792a04a25bf7d5e768da41b2a030f7a (diff) | |
Update to rust-lorawan with afit support
| -rw-r--r-- | embassy-lora/Cargo.toml | 4 | ||||
| -rw-r--r-- | embassy-lora/src/lib.rs | 13 | ||||
| -rw-r--r-- | embassy-lora/src/stm32wl/mod.rs | 12 | ||||
| -rw-r--r-- | embassy-lora/src/sx126x/mod.rs | 132 | ||||
| -rw-r--r-- | embassy-lora/src/sx127x/mod.rs | 157 | ||||
| -rw-r--r-- | examples/nrf52840/Cargo.toml | 4 | ||||
| -rw-r--r-- | examples/stm32l0/Cargo.toml | 4 | ||||
| -rw-r--r-- | examples/stm32l0/src/bin/lorawan.rs | 2 | ||||
| -rw-r--r-- | examples/stm32wl/Cargo.toml | 4 | ||||
| -rw-r--r-- | examples/stm32wl/src/bin/lorawan.rs | 2 |
10 files changed, 145 insertions, 189 deletions
diff --git a/embassy-lora/Cargo.toml b/embassy-lora/Cargo.toml index 79d5660f4..13b3acab2 100644 --- a/embassy-lora/Cargo.toml +++ b/embassy-lora/Cargo.toml | |||
| @@ -38,5 +38,5 @@ futures = { version = "0.3.17", default-features = false, features = [ "async-aw | |||
| 38 | embedded-hal = { version = "0.2", features = ["unproven"] } | 38 | embedded-hal = { version = "0.2", features = ["unproven"] } |
| 39 | bit_field = { version = "0.10" } | 39 | bit_field = { version = "0.10" } |
| 40 | 40 | ||
| 41 | lorawan-device = { version = "0.8.0", default-features = false, features = ["async"] } | 41 | lorawan-device = { version = "0.8.0", git = "https://github.com/ivajloip/rust-lorawan.git", rev = "7d3eb40bc2412536c846cea40caff25198b6b068", default-features = false, features = ["async"] } |
| 42 | lorawan = { version = "0.7.1", default-features = false } | 42 | lorawan = { version = "0.7.1", git = "https://github.com/ivajloip/rust-lorawan.git", rev = "7d3eb40bc2412536c846cea40caff25198b6b068", default-features = false } |
diff --git a/embassy-lora/src/lib.rs b/embassy-lora/src/lib.rs index 3e4748430..5c919cbb6 100644 --- a/embassy-lora/src/lib.rs +++ b/embassy-lora/src/lib.rs | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | #![no_std] | 1 | #![no_std] |
| 2 | #![feature(type_alias_impl_trait)] | 2 | #![feature(async_fn_in_trait, impl_trait_projections)] |
| 3 | #![allow(incomplete_features)] | ||
| 3 | //! embassy-lora is a collection of async radio drivers that integrate with the lorawan-device | 4 | //! embassy-lora is a collection of async radio drivers that integrate with the lorawan-device |
| 4 | //! crate's async LoRaWAN MAC implementation. | 5 | //! crate's async LoRaWAN MAC implementation. |
| 5 | 6 | ||
| @@ -34,13 +35,11 @@ impl lorawan_device::async_device::radio::Timer for LoraTimer { | |||
| 34 | self.start = Instant::now(); | 35 | self.start = Instant::now(); |
| 35 | } | 36 | } |
| 36 | 37 | ||
| 37 | type AtFuture<'m> = impl core::future::Future<Output = ()> + 'm; | 38 | async fn at(&mut self, millis: u64) { |
| 38 | fn at<'m>(&'m mut self, millis: u64) -> Self::AtFuture<'m> { | 39 | Timer::at(self.start + Duration::from_millis(millis)).await |
| 39 | Timer::at(self.start + Duration::from_millis(millis)) | ||
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | type DelayFuture<'m> = impl core::future::Future<Output = ()> + 'm; | 42 | async fn delay_ms(&mut self, millis: u64) { |
| 43 | fn delay_ms<'m>(&'m mut self, millis: u64) -> Self::DelayFuture<'m> { | 43 | Timer::after(Duration::from_millis(millis)).await |
| 44 | Timer::after(Duration::from_millis(millis)) | ||
| 45 | } | 44 | } |
| 46 | } | 45 | } |
diff --git a/embassy-lora/src/stm32wl/mod.rs b/embassy-lora/src/stm32wl/mod.rs index 3d52c1cc7..d76e8c43b 100644 --- a/embassy-lora/src/stm32wl/mod.rs +++ b/embassy-lora/src/stm32wl/mod.rs | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | //! A radio driver integration for the radio found on STM32WL family devices. | 1 | //! A radio driver integration for the radio found on STM32WL family devices. |
| 2 | use core::future::{poll_fn, Future}; | 2 | use core::future::poll_fn; |
| 3 | use core::task::Poll; | 3 | use core::task::Poll; |
| 4 | 4 | ||
| 5 | use embassy_hal_common::{into_ref, Peripheral, PeripheralRef}; | 5 | use embassy_hal_common::{into_ref, Peripheral, PeripheralRef}; |
| @@ -241,14 +241,12 @@ fn configure_radio(radio: &mut SubGhz<'_, NoDma, NoDma>, config: SubGhzRadioConf | |||
| 241 | impl<'d, RS: RadioSwitch> PhyRxTx for SubGhzRadio<'d, RS> { | 241 | impl<'d, RS: RadioSwitch> PhyRxTx for SubGhzRadio<'d, RS> { |
| 242 | type PhyError = RadioError; | 242 | type PhyError = RadioError; |
| 243 | 243 | ||
| 244 | type TxFuture<'m> = impl Future<Output = Result<u32, Self::PhyError>> + 'm where Self: 'm; | 244 | async fn tx(&mut self, config: TxConfig, buf: &[u8]) -> Result<u32, Self::PhyError> { |
| 245 | fn tx<'m>(&'m mut self, config: TxConfig, buf: &'m [u8]) -> Self::TxFuture<'m> { | 245 | self.do_tx(config, buf).await |
| 246 | async move { self.do_tx(config, buf).await } | ||
| 247 | } | 246 | } |
| 248 | 247 | ||
| 249 | type RxFuture<'m> = impl Future<Output = Result<(usize, RxQuality), Self::PhyError>> + 'm where Self: 'm; | 248 | async fn rx(&mut self, config: RfConfig, buf: &mut [u8]) -> Result<(usize, RxQuality), Self::PhyError> { |
| 250 | fn rx<'m>(&'m mut self, config: RfConfig, buf: &'m mut [u8]) -> Self::RxFuture<'m> { | 249 | self.do_rx(config, buf).await |
| 251 | async move { self.do_rx(config, buf).await } | ||
| 252 | } | 250 | } |
| 253 | } | 251 | } |
| 254 | 252 | ||
diff --git a/embassy-lora/src/sx126x/mod.rs b/embassy-lora/src/sx126x/mod.rs index 8559574cb..2f0b8c8e3 100644 --- a/embassy-lora/src/sx126x/mod.rs +++ b/embassy-lora/src/sx126x/mod.rs | |||
| @@ -1,5 +1,3 @@ | |||
| 1 | use core::future::Future; | ||
| 2 | |||
| 3 | use defmt::Format; | 1 | use defmt::Format; |
| 4 | use embedded_hal::digital::v2::OutputPin; | 2 | use embedded_hal::digital::v2::OutputPin; |
| 5 | use embedded_hal_async::digital::Wait; | 3 | use embedded_hal_async::digital::Wait; |
| @@ -71,83 +69,69 @@ where | |||
| 71 | { | 69 | { |
| 72 | type PhyError = RadioError<BUS>; | 70 | type PhyError = RadioError<BUS>; |
| 73 | 71 | ||
| 74 | type TxFuture<'m> = impl Future<Output = Result<u32, Self::PhyError>> + 'm | 72 | async fn tx(&mut self, config: TxConfig, buffer: &[u8]) -> Result<u32, Self::PhyError> { |
| 75 | where | ||
| 76 | SPI: 'm, | ||
| 77 | CTRL: 'm, | ||
| 78 | WAIT: 'm, | ||
| 79 | BUS: 'm; | ||
| 80 | |||
| 81 | fn tx<'m>(&'m mut self, config: TxConfig, buffer: &'m [u8]) -> Self::TxFuture<'m> { | ||
| 82 | trace!("TX START"); | 73 | trace!("TX START"); |
| 83 | async move { | 74 | self.lora |
| 84 | self.lora | 75 | .set_tx_config( |
| 85 | .set_tx_config( | 76 | config.pw, |
| 86 | config.pw, | 77 | config.rf.spreading_factor.into(), |
| 87 | config.rf.spreading_factor.into(), | 78 | config.rf.bandwidth.into(), |
| 88 | config.rf.bandwidth.into(), | 79 | config.rf.coding_rate.into(), |
| 89 | config.rf.coding_rate.into(), | 80 | 8, |
| 90 | 8, | 81 | false, |
| 91 | false, | 82 | true, |
| 92 | true, | 83 | false, |
| 93 | false, | 84 | 0, |
| 94 | 0, | 85 | false, |
| 95 | false, | 86 | ) |
| 96 | ) | 87 | .await?; |
| 97 | .await?; | 88 | self.lora.set_max_payload_length(buffer.len() as u8).await?; |
| 98 | self.lora.set_max_payload_length(buffer.len() as u8).await?; | 89 | self.lora.set_channel(config.rf.frequency).await?; |
| 99 | self.lora.set_channel(config.rf.frequency).await?; | 90 | self.lora.send(buffer, 0xffffff).await?; |
| 100 | self.lora.send(buffer, 0xffffff).await?; | 91 | self.lora.process_irq(None, None, None).await?; |
| 101 | self.lora.process_irq(None, None, None).await?; | 92 | trace!("TX DONE"); |
| 102 | trace!("TX DONE"); | 93 | return Ok(0); |
| 103 | return Ok(0); | ||
| 104 | } | ||
| 105 | } | 94 | } |
| 106 | 95 | ||
| 107 | type RxFuture<'m> = impl Future<Output = Result<(usize, RxQuality), Self::PhyError>> + 'm | 96 | async fn rx( |
| 108 | where | 97 | &mut self, |
| 109 | SPI: 'm, | 98 | config: RfConfig, |
| 110 | CTRL: 'm, | 99 | receiving_buffer: &mut [u8], |
| 111 | WAIT: 'm, | 100 | ) -> Result<(usize, RxQuality), Self::PhyError> { |
| 112 | BUS: 'm; | ||
| 113 | |||
| 114 | fn rx<'m>(&'m mut self, config: RfConfig, receiving_buffer: &'m mut [u8]) -> Self::RxFuture<'m> { | ||
| 115 | trace!("RX START"); | 101 | trace!("RX START"); |
| 116 | async move { | 102 | self.lora |
| 117 | self.lora | 103 | .set_rx_config( |
| 118 | .set_rx_config( | 104 | config.spreading_factor.into(), |
| 119 | config.spreading_factor.into(), | 105 | config.bandwidth.into(), |
| 120 | config.bandwidth.into(), | 106 | config.coding_rate.into(), |
| 121 | config.coding_rate.into(), | 107 | 8, |
| 122 | 8, | 108 | 4, |
| 123 | 4, | 109 | false, |
| 124 | false, | 110 | 0u8, |
| 125 | 0u8, | 111 | true, |
| 126 | true, | 112 | false, |
| 127 | false, | 113 | 0, |
| 128 | 0, | 114 | true, |
| 129 | true, | 115 | true, |
| 130 | true, | 116 | ) |
| 131 | ) | 117 | .await?; |
| 132 | .await?; | 118 | self.lora.set_max_payload_length(receiving_buffer.len() as u8).await?; |
| 133 | self.lora.set_max_payload_length(receiving_buffer.len() as u8).await?; | 119 | self.lora.set_channel(config.frequency).await?; |
| 134 | self.lora.set_channel(config.frequency).await?; | 120 | self.lora.rx(90 * 1000).await?; |
| 135 | self.lora.rx(90 * 1000).await?; | 121 | let mut received_len = 0u8; |
| 136 | let mut received_len = 0u8; | 122 | self.lora |
| 137 | self.lora | 123 | .process_irq(Some(receiving_buffer), Some(&mut received_len), None) |
| 138 | .process_irq(Some(receiving_buffer), Some(&mut received_len), None) | 124 | .await?; |
| 139 | .await?; | 125 | trace!("RX DONE"); |
| 140 | trace!("RX DONE"); | ||
| 141 | |||
| 142 | let packet_status = self.lora.get_latest_packet_status(); | ||
| 143 | let mut rssi = 0i16; | ||
| 144 | let mut snr = 0i8; | ||
| 145 | if packet_status.is_some() { | ||
| 146 | rssi = packet_status.unwrap().rssi as i16; | ||
| 147 | snr = packet_status.unwrap().snr; | ||
| 148 | } | ||
| 149 | 126 | ||
| 150 | Ok((received_len as usize, RxQuality::new(rssi, snr))) | 127 | let packet_status = self.lora.get_latest_packet_status(); |
| 128 | let mut rssi = 0i16; | ||
| 129 | let mut snr = 0i8; | ||
| 130 | if packet_status.is_some() { | ||
| 131 | rssi = packet_status.unwrap().rssi as i16; | ||
| 132 | snr = packet_status.unwrap().snr; | ||
| 151 | } | 133 | } |
| 134 | |||
| 135 | Ok((received_len as usize, RxQuality::new(rssi, snr))) | ||
| 152 | } | 136 | } |
| 153 | } | 137 | } |
diff --git a/embassy-lora/src/sx127x/mod.rs b/embassy-lora/src/sx127x/mod.rs index 8904c9a13..4e8dc2232 100644 --- a/embassy-lora/src/sx127x/mod.rs +++ b/embassy-lora/src/sx127x/mod.rs | |||
| @@ -1,5 +1,3 @@ | |||
| 1 | use core::future::Future; | ||
| 2 | |||
| 3 | use embedded_hal::digital::v2::OutputPin; | 1 | use embedded_hal::digital::v2::OutputPin; |
| 4 | use embedded_hal_async::digital::Wait; | 2 | use embedded_hal_async::digital::Wait; |
| 5 | use embedded_hal_async::spi::*; | 3 | use embedded_hal_async::spi::*; |
| @@ -88,101 +86,78 @@ where | |||
| 88 | { | 86 | { |
| 89 | type PhyError = Sx127xError; | 87 | type PhyError = Sx127xError; |
| 90 | 88 | ||
| 91 | type TxFuture<'m> = impl Future<Output = Result<u32, Self::PhyError>> + 'm | 89 | async fn tx(&mut self, config: TxConfig, buf: &[u8]) -> Result<u32, Self::PhyError> { |
| 92 | where | ||
| 93 | SPI: 'm, | ||
| 94 | CS: 'm, | ||
| 95 | RESET: 'm, | ||
| 96 | E: 'm, | ||
| 97 | I: 'm, | ||
| 98 | RFS: 'm; | ||
| 99 | |||
| 100 | fn tx<'m>(&'m mut self, config: TxConfig, buf: &'m [u8]) -> Self::TxFuture<'m> { | ||
| 101 | trace!("TX START"); | 90 | trace!("TX START"); |
| 102 | async move { | 91 | self.radio.set_mode(RadioMode::Stdby).await.ok().unwrap(); |
| 92 | self.rfs.set_tx(); | ||
| 93 | self.radio.set_tx_power(14, 0).await?; | ||
| 94 | self.radio.set_frequency(config.rf.frequency).await?; | ||
| 95 | // TODO: Modify radio to support other coding rates | ||
| 96 | self.radio.set_coding_rate_4(5).await?; | ||
| 97 | self.radio | ||
| 98 | .set_signal_bandwidth(bandwidth_to_i64(config.rf.bandwidth)) | ||
| 99 | .await?; | ||
| 100 | self.radio | ||
| 101 | .set_spreading_factor(spreading_factor_to_u8(config.rf.spreading_factor)) | ||
| 102 | .await?; | ||
| 103 | |||
| 104 | self.radio.set_preamble_length(8).await?; | ||
| 105 | self.radio.set_lora_pa_ramp().await?; | ||
| 106 | self.radio.set_lora_sync_word().await?; | ||
| 107 | self.radio.set_invert_iq(false).await?; | ||
| 108 | self.radio.set_crc(true).await?; | ||
| 109 | |||
| 110 | self.radio.set_dio0_tx_done().await?; | ||
| 111 | |||
| 112 | self.radio.transmit_start(buf).await?; | ||
| 113 | |||
| 114 | loop { | ||
| 115 | self.irq.wait_for_rising_edge().await.unwrap(); | ||
| 103 | self.radio.set_mode(RadioMode::Stdby).await.ok().unwrap(); | 116 | self.radio.set_mode(RadioMode::Stdby).await.ok().unwrap(); |
| 104 | self.rfs.set_tx(); | 117 | let irq = self.radio.clear_irq().await.ok().unwrap(); |
| 105 | self.radio.set_tx_power(14, 0).await?; | 118 | if (irq & IRQ::IrqTxDoneMask.addr()) != 0 { |
| 106 | self.radio.set_frequency(config.rf.frequency).await?; | 119 | trace!("TX DONE"); |
| 107 | // TODO: Modify radio to support other coding rates | 120 | return Ok(0); |
| 108 | self.radio.set_coding_rate_4(5).await?; | ||
| 109 | self.radio | ||
| 110 | .set_signal_bandwidth(bandwidth_to_i64(config.rf.bandwidth)) | ||
| 111 | .await?; | ||
| 112 | self.radio | ||
| 113 | .set_spreading_factor(spreading_factor_to_u8(config.rf.spreading_factor)) | ||
| 114 | .await?; | ||
| 115 | |||
| 116 | self.radio.set_preamble_length(8).await?; | ||
| 117 | self.radio.set_lora_pa_ramp().await?; | ||
| 118 | self.radio.set_lora_sync_word().await?; | ||
| 119 | self.radio.set_invert_iq(false).await?; | ||
| 120 | self.radio.set_crc(true).await?; | ||
| 121 | |||
| 122 | self.radio.set_dio0_tx_done().await?; | ||
| 123 | |||
| 124 | self.radio.transmit_start(buf).await?; | ||
| 125 | |||
| 126 | loop { | ||
| 127 | self.irq.wait_for_rising_edge().await.unwrap(); | ||
| 128 | self.radio.set_mode(RadioMode::Stdby).await.ok().unwrap(); | ||
| 129 | let irq = self.radio.clear_irq().await.ok().unwrap(); | ||
| 130 | if (irq & IRQ::IrqTxDoneMask.addr()) != 0 { | ||
| 131 | trace!("TX DONE"); | ||
| 132 | return Ok(0); | ||
| 133 | } | ||
| 134 | } | 121 | } |
| 135 | } | 122 | } |
| 136 | } | 123 | } |
| 137 | 124 | ||
| 138 | type RxFuture<'m> = impl Future<Output = Result<(usize, RxQuality), Self::PhyError>> + 'm | 125 | async fn rx(&mut self, config: RfConfig, buf: &mut [u8]) -> Result<(usize, RxQuality), Self::PhyError> { |
| 139 | where | 126 | self.rfs.set_rx(); |
| 140 | SPI: 'm, | 127 | self.radio.reset_payload_length().await?; |
| 141 | CS: 'm, | 128 | self.radio.set_frequency(config.frequency).await?; |
| 142 | RESET: 'm, | 129 | // TODO: Modify radio to support other coding rates |
| 143 | E: 'm, | 130 | self.radio.set_coding_rate_4(5).await?; |
| 144 | I: 'm, | 131 | self.radio |
| 145 | RFS: 'm; | 132 | .set_signal_bandwidth(bandwidth_to_i64(config.bandwidth)) |
| 146 | 133 | .await?; | |
| 147 | fn rx<'m>(&'m mut self, config: RfConfig, buf: &'m mut [u8]) -> Self::RxFuture<'m> { | 134 | self.radio |
| 148 | trace!("RX START"); | 135 | .set_spreading_factor(spreading_factor_to_u8(config.spreading_factor)) |
| 149 | async move { | 136 | .await?; |
| 150 | self.rfs.set_rx(); | 137 | |
| 151 | self.radio.reset_payload_length().await?; | 138 | self.radio.set_preamble_length(8).await?; |
| 152 | self.radio.set_frequency(config.frequency).await?; | 139 | self.radio.set_lora_sync_word().await?; |
| 153 | // TODO: Modify radio to support other coding rates | 140 | self.radio.set_invert_iq(true).await?; |
| 154 | self.radio.set_coding_rate_4(5).await?; | 141 | self.radio.set_crc(true).await?; |
| 155 | self.radio | 142 | |
| 156 | .set_signal_bandwidth(bandwidth_to_i64(config.bandwidth)) | 143 | self.radio.set_dio0_rx_done().await?; |
| 157 | .await?; | 144 | self.radio.set_mode(RadioMode::RxContinuous).await?; |
| 158 | self.radio | 145 | |
| 159 | .set_spreading_factor(spreading_factor_to_u8(config.spreading_factor)) | 146 | loop { |
| 160 | .await?; | 147 | self.irq.wait_for_rising_edge().await.unwrap(); |
| 161 | 148 | self.radio.set_mode(RadioMode::Stdby).await.ok().unwrap(); | |
| 162 | self.radio.set_preamble_length(8).await?; | 149 | let irq = self.radio.clear_irq().await.ok().unwrap(); |
| 163 | self.radio.set_lora_sync_word().await?; | 150 | if (irq & IRQ::IrqRxDoneMask.addr()) != 0 { |
| 164 | self.radio.set_invert_iq(true).await?; | 151 | let rssi = self.radio.get_packet_rssi().await.unwrap_or(0) as i16; |
| 165 | self.radio.set_crc(true).await?; | 152 | let snr = self.radio.get_packet_snr().await.unwrap_or(0.0) as i8; |
| 166 | 153 | let response = if let Ok(size) = self.radio.read_packet_size().await { | |
| 167 | self.radio.set_dio0_rx_done().await?; | 154 | self.radio.read_packet(buf).await?; |
| 168 | self.radio.set_mode(RadioMode::RxContinuous).await?; | 155 | Ok((size, RxQuality::new(rssi, snr))) |
| 169 | 156 | } else { | |
| 170 | loop { | 157 | Ok((0, RxQuality::new(rssi, snr))) |
| 171 | self.irq.wait_for_rising_edge().await.unwrap(); | 158 | }; |
| 172 | self.radio.set_mode(RadioMode::Stdby).await.ok().unwrap(); | 159 | trace!("RX DONE"); |
| 173 | let irq = self.radio.clear_irq().await.ok().unwrap(); | 160 | return response; |
| 174 | if (irq & IRQ::IrqRxDoneMask.addr()) != 0 { | ||
| 175 | let rssi = self.radio.get_packet_rssi().await.unwrap_or(0) as i16; | ||
| 176 | let snr = self.radio.get_packet_snr().await.unwrap_or(0.0) as i8; | ||
| 177 | let response = if let Ok(size) = self.radio.read_packet_size().await { | ||
| 178 | self.radio.read_packet(buf).await?; | ||
| 179 | Ok((size, RxQuality::new(rssi, snr))) | ||
| 180 | } else { | ||
| 181 | Ok((0, RxQuality::new(rssi, snr))) | ||
| 182 | }; | ||
| 183 | trace!("RX DONE"); | ||
| 184 | return response; | ||
| 185 | } | ||
| 186 | } | 161 | } |
| 187 | } | 162 | } |
| 188 | } | 163 | } |
diff --git a/examples/nrf52840/Cargo.toml b/examples/nrf52840/Cargo.toml index fc614cb80..9ef7944c4 100644 --- a/examples/nrf52840/Cargo.toml +++ b/examples/nrf52840/Cargo.toml | |||
| @@ -20,8 +20,8 @@ embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defm | |||
| 20 | embedded-io = "0.4.0" | 20 | embedded-io = "0.4.0" |
| 21 | embassy-lora = { version = "0.1.0", path = "../../embassy-lora", features = ["sx126x", "time", "defmt"], optional = true } | 21 | embassy-lora = { version = "0.1.0", path = "../../embassy-lora", features = ["sx126x", "time", "defmt"], optional = true } |
| 22 | 22 | ||
| 23 | lorawan-device = { version = "0.8.0", default-features = false, features = ["async"], optional = true } | 23 | lorawan-device = { version = "0.8.0", git = "https://github.com/ivajloip/rust-lorawan.git", rev = "7d3eb40bc2412536c846cea40caff25198b6b068", default-features = false, features = ["async"], optional = true } |
| 24 | lorawan = { version = "0.7.1", default-features = false, features = ["default-crypto"], optional = true } | 24 | lorawan = { version = "0.7.1", git = "https://github.com/ivajloip/rust-lorawan.git", rev = "7d3eb40bc2412536c846cea40caff25198b6b068", default-features = false, features = ["default-crypto"], optional = true } |
| 25 | 25 | ||
| 26 | defmt = "0.3" | 26 | defmt = "0.3" |
| 27 | defmt-rtt = "0.4" | 27 | defmt-rtt = "0.4" |
diff --git a/examples/stm32l0/Cargo.toml b/examples/stm32l0/Cargo.toml index d446d41b2..9f63fee1c 100644 --- a/examples/stm32l0/Cargo.toml +++ b/examples/stm32l0/Cargo.toml | |||
| @@ -15,8 +15,8 @@ embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["de | |||
| 15 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32l072cz", "time-driver-any", "exti", "unstable-traits", "memory-x"] } | 15 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32l072cz", "time-driver-any", "exti", "unstable-traits", "memory-x"] } |
| 16 | embassy-lora = { version = "0.1.0", path = "../../embassy-lora", features = ["sx127x", "time", "defmt"], optional = true} | 16 | embassy-lora = { version = "0.1.0", path = "../../embassy-lora", features = ["sx127x", "time", "defmt"], optional = true} |
| 17 | 17 | ||
| 18 | lorawan-device = { version = "0.8.0", default-features = false, features = ["async"], optional = true } | 18 | lorawan-device = { version = "0.8.0", git = "https://github.com/ivajloip/rust-lorawan.git", rev = "7d3eb40bc2412536c846cea40caff25198b6b068", default-features = false, features = ["async"], optional = true } |
| 19 | lorawan = { version = "0.7.1", default-features = false, features = ["default-crypto"], optional = true } | 19 | lorawan = { version = "0.7.1", git = "https://github.com/ivajloip/rust-lorawan.git", rev = "7d3eb40bc2412536c846cea40caff25198b6b068", default-features = false, features = ["default-crypto"], optional = true } |
| 20 | 20 | ||
| 21 | defmt = "0.3" | 21 | defmt = "0.3" |
| 22 | defmt-rtt = "0.4" | 22 | defmt-rtt = "0.4" |
diff --git a/examples/stm32l0/src/bin/lorawan.rs b/examples/stm32l0/src/bin/lorawan.rs index 27d7c29c2..ea01f610c 100644 --- a/examples/stm32l0/src/bin/lorawan.rs +++ b/examples/stm32l0/src/bin/lorawan.rs | |||
| @@ -45,7 +45,7 @@ async fn main(_spawner: Spawner) { | |||
| 45 | 45 | ||
| 46 | let radio = Sx127xRadio::new(spi, cs, reset, ready_pin, DummySwitch).await.unwrap(); | 46 | let radio = Sx127xRadio::new(spi, cs, reset, ready_pin, DummySwitch).await.unwrap(); |
| 47 | 47 | ||
| 48 | let region = region::EU868::default().into(); | 48 | let region = region::Configuration::new(region::Region::EU868); |
| 49 | let mut device: Device<_, Crypto, _, _> = Device::new(region, radio, LoraTimer::new(), Rng::new(p.RNG)); | 49 | let mut device: Device<_, Crypto, _, _> = Device::new(region, radio, LoraTimer::new(), Rng::new(p.RNG)); |
| 50 | 50 | ||
| 51 | defmt::info!("Joining LoRaWAN network"); | 51 | defmt::info!("Joining LoRaWAN network"); |
diff --git a/examples/stm32wl/Cargo.toml b/examples/stm32wl/Cargo.toml index df295ca49..19a7cfcea 100644 --- a/examples/stm32wl/Cargo.toml +++ b/examples/stm32wl/Cargo.toml | |||
| @@ -11,8 +11,8 @@ embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["de | |||
| 11 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32wl55jc-cm4", "time-driver-any", "memory-x", "unstable-pac", "exti"] } | 11 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32wl55jc-cm4", "time-driver-any", "memory-x", "unstable-pac", "exti"] } |
| 12 | embassy-lora = { version = "0.1.0", path = "../../embassy-lora", features = ["stm32wl", "time", "defmt"] } | 12 | embassy-lora = { version = "0.1.0", path = "../../embassy-lora", features = ["stm32wl", "time", "defmt"] } |
| 13 | 13 | ||
| 14 | lorawan-device = { version = "0.8.0", default-features = false, features = ["async"] } | 14 | lorawan-device = { version = "0.8.0", git = "https://github.com/ivajloip/rust-lorawan.git", rev = "7d3eb40bc2412536c846cea40caff25198b6b068", default-features = false, features = ["async"] } |
| 15 | lorawan = { version = "0.7.1", default-features = false, features = ["default-crypto"] } | 15 | lorawan = { version = "0.7.1", git = "https://github.com/ivajloip/rust-lorawan.git", rev = "7d3eb40bc2412536c846cea40caff25198b6b068", default-features = false, features = ["default-crypto"] } |
| 16 | 16 | ||
| 17 | defmt = "0.3" | 17 | defmt = "0.3" |
| 18 | defmt-rtt = "0.4" | 18 | defmt-rtt = "0.4" |
diff --git a/examples/stm32wl/src/bin/lorawan.rs b/examples/stm32wl/src/bin/lorawan.rs index 7f34dd306..32f29cc5d 100644 --- a/examples/stm32wl/src/bin/lorawan.rs +++ b/examples/stm32wl/src/bin/lorawan.rs | |||
| @@ -63,7 +63,7 @@ async fn main(_spawner: Spawner) { | |||
| 63 | radio_config.calibrate_image = CalibrateImage::ISM_863_870; | 63 | radio_config.calibrate_image = CalibrateImage::ISM_863_870; |
| 64 | let radio = SubGhzRadio::new(radio, rfs, irq, radio_config).unwrap(); | 64 | let radio = SubGhzRadio::new(radio, rfs, irq, radio_config).unwrap(); |
| 65 | 65 | ||
| 66 | let mut region: region::Configuration = region::EU868::default().into(); | 66 | let mut region = region::Configuration::new(region::Region::EU868); |
| 67 | 67 | ||
| 68 | // NOTE: This is specific for TTN, as they have a special RX1 delay | 68 | // NOTE: This is specific for TTN, as they have a special RX1 delay |
| 69 | region.set_receive_delay1(5000); | 69 | region.set_receive_delay1(5000); |
