diff options
| author | xoviat <[email protected]> | 2023-05-24 18:09:04 -0500 |
|---|---|---|
| committer | xoviat <[email protected]> | 2023-05-24 18:09:04 -0500 |
| commit | b6ba1ea53ada2f503ae89de66490957723a21866 (patch) | |
| tree | 759273f8160ab66b8793044a456342fd6ee5a573 | |
| parent | 316be179af500fdf31606f085adf77c6879a396d (diff) | |
stm32: move lora to bind_interrupts
| -rwxr-xr-x | ci.sh | 2 | ||||
| -rw-r--r-- | embassy-lora/src/iv.rs | 36 | ||||
| -rw-r--r-- | examples/stm32wl/src/bin/lora_lorawan.rs | 12 | ||||
| -rw-r--r-- | examples/stm32wl/src/bin/lora_p2p_receive.rs | 12 | ||||
| -rw-r--r-- | examples/stm32wl/src/bin/lora_p2p_send.rs | 12 | ||||
| -rw-r--r-- | examples/stm32wl/src/bin/uart_async.rs | 15 |
6 files changed, 52 insertions, 37 deletions
| @@ -112,6 +112,7 @@ cargo batch \ | |||
| 112 | --- build --release --manifest-path examples/stm32l5/Cargo.toml --target thumbv8m.main-none-eabihf --out-dir out/examples/stm32l5 \ | 112 | --- build --release --manifest-path examples/stm32l5/Cargo.toml --target thumbv8m.main-none-eabihf --out-dir out/examples/stm32l5 \ |
| 113 | --- build --release --manifest-path examples/stm32u5/Cargo.toml --target thumbv8m.main-none-eabihf --out-dir out/examples/stm32u5 \ | 113 | --- build --release --manifest-path examples/stm32u5/Cargo.toml --target thumbv8m.main-none-eabihf --out-dir out/examples/stm32u5 \ |
| 114 | --- build --release --manifest-path examples/stm32wb/Cargo.toml --target thumbv7em-none-eabihf --out-dir out/examples/stm32wb \ | 114 | --- build --release --manifest-path examples/stm32wb/Cargo.toml --target thumbv7em-none-eabihf --out-dir out/examples/stm32wb \ |
| 115 | --- build --release --manifest-path examples/stm32wl/Cargo.toml --target thumbv7em-none-eabihf --out-dir out/examples/stm32wl \ | ||
| 115 | --- build --release --manifest-path examples/boot/application/nrf/Cargo.toml --target thumbv7em-none-eabi --features embassy-nrf/nrf52840 --out-dir out/examples/boot/nrf --bin b \ | 116 | --- build --release --manifest-path examples/boot/application/nrf/Cargo.toml --target thumbv7em-none-eabi --features embassy-nrf/nrf52840 --out-dir out/examples/boot/nrf --bin b \ |
| 116 | --- build --release --manifest-path examples/boot/application/nrf/Cargo.toml --target thumbv8m.main-none-eabihf --features embassy-nrf/nrf9160-ns --out-dir out/examples/boot/nrf --bin b \ | 117 | --- build --release --manifest-path examples/boot/application/nrf/Cargo.toml --target thumbv8m.main-none-eabihf --features embassy-nrf/nrf9160-ns --out-dir out/examples/boot/nrf --bin b \ |
| 117 | --- build --release --manifest-path examples/boot/application/rp/Cargo.toml --target thumbv6m-none-eabi --out-dir out/examples/boot/rp --bin b \ | 118 | --- build --release --manifest-path examples/boot/application/rp/Cargo.toml --target thumbv6m-none-eabi --out-dir out/examples/boot/rp --bin b \ |
| @@ -142,7 +143,6 @@ cargo batch \ | |||
| 142 | $BUILD_EXTRA | 143 | $BUILD_EXTRA |
| 143 | 144 | ||
| 144 | 145 | ||
| 145 | # --- build --release --manifest-path examples/stm32wl/Cargo.toml --target thumbv7em-none-eabihf --out-dir out/examples/stm32wl \ | ||
| 146 | 146 | ||
| 147 | function run_elf { | 147 | function run_elf { |
| 148 | echo Running target=$1 elf=$2 | 148 | echo Running target=$1 elf=$2 |
diff --git a/embassy-lora/src/iv.rs b/embassy-lora/src/iv.rs index f81134405..d515bc365 100644 --- a/embassy-lora/src/iv.rs +++ b/embassy-lora/src/iv.rs | |||
| @@ -1,7 +1,9 @@ | |||
| 1 | #[cfg(feature = "stm32wl")] | 1 | #[cfg(feature = "stm32wl")] |
| 2 | use embassy_stm32::interrupt; | ||
| 3 | #[cfg(feature = "stm32wl")] | ||
| 2 | use embassy_stm32::interrupt::*; | 4 | use embassy_stm32::interrupt::*; |
| 3 | #[cfg(feature = "stm32wl")] | 5 | #[cfg(feature = "stm32wl")] |
| 4 | use embassy_stm32::{pac, PeripheralRef}; | 6 | use embassy_stm32::pac; |
| 5 | #[cfg(feature = "stm32wl")] | 7 | #[cfg(feature = "stm32wl")] |
| 6 | use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; | 8 | use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; |
| 7 | #[cfg(feature = "stm32wl")] | 9 | #[cfg(feature = "stm32wl")] |
| @@ -13,47 +15,51 @@ use lora_phy::mod_params::RadioError::*; | |||
| 13 | use lora_phy::mod_params::{BoardType, RadioError}; | 15 | use lora_phy::mod_params::{BoardType, RadioError}; |
| 14 | use lora_phy::mod_traits::InterfaceVariant; | 16 | use lora_phy::mod_traits::InterfaceVariant; |
| 15 | 17 | ||
| 18 | /// Interrupt handler. | ||
| 19 | #[cfg(feature = "stm32wl")] | ||
| 20 | pub struct InterruptHandler {} | ||
| 21 | |||
| 22 | #[cfg(feature = "stm32wl")] | ||
| 23 | impl interrupt::Handler<interrupt::SUBGHZ_RADIO> for InterruptHandler { | ||
| 24 | unsafe fn on_interrupt() { | ||
| 25 | unsafe { SUBGHZ_RADIO::steal() }.disable(); | ||
| 26 | IRQ_SIGNAL.signal(()); | ||
| 27 | } | ||
| 28 | } | ||
| 29 | |||
| 16 | #[cfg(feature = "stm32wl")] | 30 | #[cfg(feature = "stm32wl")] |
| 17 | static IRQ_SIGNAL: Signal<CriticalSectionRawMutex, ()> = Signal::new(); | 31 | static IRQ_SIGNAL: Signal<CriticalSectionRawMutex, ()> = Signal::new(); |
| 18 | 32 | ||
| 19 | #[cfg(feature = "stm32wl")] | 33 | #[cfg(feature = "stm32wl")] |
| 20 | /// Base for the InterfaceVariant implementation for an stm32wl/sx1262 combination | 34 | /// Base for the InterfaceVariant implementation for an stm32wl/sx1262 combination |
| 21 | pub struct Stm32wlInterfaceVariant<'a, CTRL> { | 35 | pub struct Stm32wlInterfaceVariant<CTRL> { |
| 22 | board_type: BoardType, | 36 | board_type: BoardType, |
| 23 | irq: PeripheralRef<'a, SUBGHZ_RADIO>, | ||
| 24 | rf_switch_rx: Option<CTRL>, | 37 | rf_switch_rx: Option<CTRL>, |
| 25 | rf_switch_tx: Option<CTRL>, | 38 | rf_switch_tx: Option<CTRL>, |
| 26 | } | 39 | } |
| 27 | 40 | ||
| 28 | #[cfg(feature = "stm32wl")] | 41 | #[cfg(feature = "stm32wl")] |
| 29 | impl<'a, CTRL> Stm32wlInterfaceVariant<'a, CTRL> | 42 | impl<'a, CTRL> Stm32wlInterfaceVariant<CTRL> |
| 30 | where | 43 | where |
| 31 | CTRL: OutputPin, | 44 | CTRL: OutputPin, |
| 32 | { | 45 | { |
| 33 | /// Create an InterfaceVariant instance for an stm32wl/sx1262 combination | 46 | /// Create an InterfaceVariant instance for an stm32wl/sx1262 combination |
| 34 | pub fn new( | 47 | pub fn new( |
| 35 | irq: PeripheralRef<'a, SUBGHZ_RADIO>, | 48 | _irq: impl interrupt::Binding<interrupt::SUBGHZ_RADIO, InterruptHandler>, |
| 36 | rf_switch_rx: Option<CTRL>, | 49 | rf_switch_rx: Option<CTRL>, |
| 37 | rf_switch_tx: Option<CTRL>, | 50 | rf_switch_tx: Option<CTRL>, |
| 38 | ) -> Result<Self, RadioError> { | 51 | ) -> Result<Self, RadioError> { |
| 39 | irq.disable(); | 52 | unsafe { interrupt::SUBGHZ_RADIO::steal() }.disable(); |
| 40 | irq.set_handler(Self::on_interrupt); | ||
| 41 | Ok(Self { | 53 | Ok(Self { |
| 42 | board_type: BoardType::Stm32wlSx1262, // updated when associated with a specific LoRa board | 54 | board_type: BoardType::Stm32wlSx1262, // updated when associated with a specific LoRa board |
| 43 | irq, | ||
| 44 | rf_switch_rx, | 55 | rf_switch_rx, |
| 45 | rf_switch_tx, | 56 | rf_switch_tx, |
| 46 | }) | 57 | }) |
| 47 | } | 58 | } |
| 48 | |||
| 49 | fn on_interrupt(_: *mut ()) { | ||
| 50 | unsafe { SUBGHZ_RADIO::steal() }.disable(); | ||
| 51 | IRQ_SIGNAL.signal(()); | ||
| 52 | } | ||
| 53 | } | 59 | } |
| 54 | 60 | ||
| 55 | #[cfg(feature = "stm32wl")] | 61 | #[cfg(feature = "stm32wl")] |
| 56 | impl<CTRL> InterfaceVariant for Stm32wlInterfaceVariant<'_, CTRL> | 62 | impl<CTRL> InterfaceVariant for Stm32wlInterfaceVariant<CTRL> |
| 57 | where | 63 | where |
| 58 | CTRL: OutputPin, | 64 | CTRL: OutputPin, |
| 59 | { | 65 | { |
| @@ -89,7 +95,7 @@ where | |||
| 89 | } | 95 | } |
| 90 | 96 | ||
| 91 | async fn await_irq(&mut self) -> Result<(), RadioError> { | 97 | async fn await_irq(&mut self) -> Result<(), RadioError> { |
| 92 | self.irq.enable(); | 98 | unsafe { interrupt::SUBGHZ_RADIO::steal() }.enable(); |
| 93 | IRQ_SIGNAL.wait().await; | 99 | IRQ_SIGNAL.wait().await; |
| 94 | Ok(()) | 100 | Ok(()) |
| 95 | } | 101 | } |
diff --git a/examples/stm32wl/src/bin/lora_lorawan.rs b/examples/stm32wl/src/bin/lora_lorawan.rs index 1a271b2f2..e179c5ca1 100644 --- a/examples/stm32wl/src/bin/lora_lorawan.rs +++ b/examples/stm32wl/src/bin/lora_lorawan.rs | |||
| @@ -7,12 +7,12 @@ | |||
| 7 | 7 | ||
| 8 | use defmt::info; | 8 | use defmt::info; |
| 9 | use embassy_executor::Spawner; | 9 | use embassy_executor::Spawner; |
| 10 | use embassy_lora::iv::Stm32wlInterfaceVariant; | 10 | use embassy_lora::iv::{InterruptHandler, Stm32wlInterfaceVariant}; |
| 11 | use embassy_lora::LoraTimer; | 11 | use embassy_lora::LoraTimer; |
| 12 | use embassy_stm32::gpio::{Level, Output, Pin, Speed}; | 12 | use embassy_stm32::gpio::{Level, Output, Pin, Speed}; |
| 13 | use embassy_stm32::rng::Rng; | 13 | use embassy_stm32::rng::Rng; |
| 14 | use embassy_stm32::spi::Spi; | 14 | use embassy_stm32::spi::Spi; |
| 15 | use embassy_stm32::{interrupt, into_ref, pac, Peripheral}; | 15 | use embassy_stm32::{bind_interrupts, pac}; |
| 16 | use embassy_time::Delay; | 16 | use embassy_time::Delay; |
| 17 | use lora_phy::mod_params::*; | 17 | use lora_phy::mod_params::*; |
| 18 | use lora_phy::sx1261_2::SX1261_2; | 18 | use lora_phy::sx1261_2::SX1261_2; |
| @@ -24,6 +24,10 @@ use {defmt_rtt as _, panic_probe as _}; | |||
| 24 | 24 | ||
| 25 | const LORAWAN_REGION: region::Region = region::Region::EU868; // warning: set this appropriately for the region | 25 | const LORAWAN_REGION: region::Region = region::Region::EU868; // warning: set this appropriately for the region |
| 26 | 26 | ||
| 27 | bind_interrupts!(struct Irqs{ | ||
| 28 | SUBGHZ_RADIO => InterruptHandler; | ||
| 29 | }); | ||
| 30 | |||
| 27 | #[embassy_executor::main] | 31 | #[embassy_executor::main] |
| 28 | async fn main(_spawner: Spawner) { | 32 | async fn main(_spawner: Spawner) { |
| 29 | let mut config = embassy_stm32::Config::default(); | 33 | let mut config = embassy_stm32::Config::default(); |
| @@ -35,13 +39,11 @@ async fn main(_spawner: Spawner) { | |||
| 35 | 39 | ||
| 36 | let spi = Spi::new_subghz(p.SUBGHZSPI, p.DMA1_CH1, p.DMA1_CH2); | 40 | let spi = Spi::new_subghz(p.SUBGHZSPI, p.DMA1_CH1, p.DMA1_CH2); |
| 37 | 41 | ||
| 38 | let irq = interrupt::take!(SUBGHZ_RADIO); | ||
| 39 | into_ref!(irq); | ||
| 40 | // Set CTRL1 and CTRL3 for high-power transmission, while CTRL2 acts as an RF switch between tx and rx | 42 | // Set CTRL1 and CTRL3 for high-power transmission, while CTRL2 acts as an RF switch between tx and rx |
| 41 | let _ctrl1 = Output::new(p.PC4.degrade(), Level::Low, Speed::High); | 43 | let _ctrl1 = Output::new(p.PC4.degrade(), Level::Low, Speed::High); |
| 42 | let ctrl2 = Output::new(p.PC5.degrade(), Level::High, Speed::High); | 44 | let ctrl2 = Output::new(p.PC5.degrade(), Level::High, Speed::High); |
| 43 | let _ctrl3 = Output::new(p.PC3.degrade(), Level::High, Speed::High); | 45 | let _ctrl3 = Output::new(p.PC3.degrade(), Level::High, Speed::High); |
| 44 | let iv = Stm32wlInterfaceVariant::new(irq, None, Some(ctrl2)).unwrap(); | 46 | let iv = Stm32wlInterfaceVariant::new(Irqs, None, Some(ctrl2)).unwrap(); |
| 45 | 47 | ||
| 46 | let mut delay = Delay; | 48 | let mut delay = Delay; |
| 47 | 49 | ||
diff --git a/examples/stm32wl/src/bin/lora_p2p_receive.rs b/examples/stm32wl/src/bin/lora_p2p_receive.rs index 5e80e8f6a..d3f051b1c 100644 --- a/examples/stm32wl/src/bin/lora_p2p_receive.rs +++ b/examples/stm32wl/src/bin/lora_p2p_receive.rs | |||
| @@ -7,10 +7,10 @@ | |||
| 7 | 7 | ||
| 8 | use defmt::info; | 8 | use defmt::info; |
| 9 | use embassy_executor::Spawner; | 9 | use embassy_executor::Spawner; |
| 10 | use embassy_lora::iv::Stm32wlInterfaceVariant; | 10 | use embassy_lora::iv::{InterruptHandler, Stm32wlInterfaceVariant}; |
| 11 | use embassy_stm32::bind_interrupts; | ||
| 11 | use embassy_stm32::gpio::{Level, Output, Pin, Speed}; | 12 | use embassy_stm32::gpio::{Level, Output, Pin, Speed}; |
| 12 | use embassy_stm32::spi::Spi; | 13 | use embassy_stm32::spi::Spi; |
| 13 | use embassy_stm32::{interrupt, into_ref, Peripheral}; | ||
| 14 | use embassy_time::{Delay, Duration, Timer}; | 14 | use embassy_time::{Delay, Duration, Timer}; |
| 15 | use lora_phy::mod_params::*; | 15 | use lora_phy::mod_params::*; |
| 16 | use lora_phy::sx1261_2::SX1261_2; | 16 | use lora_phy::sx1261_2::SX1261_2; |
| @@ -19,6 +19,10 @@ use {defmt_rtt as _, panic_probe as _}; | |||
| 19 | 19 | ||
| 20 | const LORA_FREQUENCY_IN_HZ: u32 = 903_900_000; // warning: set this appropriately for the region | 20 | const LORA_FREQUENCY_IN_HZ: u32 = 903_900_000; // warning: set this appropriately for the region |
| 21 | 21 | ||
| 22 | bind_interrupts!(struct Irqs{ | ||
| 23 | SUBGHZ_RADIO => InterruptHandler; | ||
| 24 | }); | ||
| 25 | |||
| 22 | #[embassy_executor::main] | 26 | #[embassy_executor::main] |
| 23 | async fn main(_spawner: Spawner) { | 27 | async fn main(_spawner: Spawner) { |
| 24 | let mut config = embassy_stm32::Config::default(); | 28 | let mut config = embassy_stm32::Config::default(); |
| @@ -27,13 +31,11 @@ async fn main(_spawner: Spawner) { | |||
| 27 | 31 | ||
| 28 | let spi = Spi::new_subghz(p.SUBGHZSPI, p.DMA1_CH1, p.DMA1_CH2); | 32 | let spi = Spi::new_subghz(p.SUBGHZSPI, p.DMA1_CH1, p.DMA1_CH2); |
| 29 | 33 | ||
| 30 | let irq = interrupt::take!(SUBGHZ_RADIO); | ||
| 31 | into_ref!(irq); | ||
| 32 | // Set CTRL1 and CTRL3 for high-power transmission, while CTRL2 acts as an RF switch between tx and rx | 34 | // Set CTRL1 and CTRL3 for high-power transmission, while CTRL2 acts as an RF switch between tx and rx |
| 33 | let _ctrl1 = Output::new(p.PC4.degrade(), Level::Low, Speed::High); | 35 | let _ctrl1 = Output::new(p.PC4.degrade(), Level::Low, Speed::High); |
| 34 | let ctrl2 = Output::new(p.PC5.degrade(), Level::High, Speed::High); | 36 | let ctrl2 = Output::new(p.PC5.degrade(), Level::High, Speed::High); |
| 35 | let _ctrl3 = Output::new(p.PC3.degrade(), Level::High, Speed::High); | 37 | let _ctrl3 = Output::new(p.PC3.degrade(), Level::High, Speed::High); |
| 36 | let iv = Stm32wlInterfaceVariant::new(irq, None, Some(ctrl2)).unwrap(); | 38 | let iv = Stm32wlInterfaceVariant::new(Irqs, None, Some(ctrl2)).unwrap(); |
| 37 | 39 | ||
| 38 | let mut delay = Delay; | 40 | let mut delay = Delay; |
| 39 | 41 | ||
diff --git a/examples/stm32wl/src/bin/lora_p2p_send.rs b/examples/stm32wl/src/bin/lora_p2p_send.rs index e22c714bd..fc5205c85 100644 --- a/examples/stm32wl/src/bin/lora_p2p_send.rs +++ b/examples/stm32wl/src/bin/lora_p2p_send.rs | |||
| @@ -7,10 +7,10 @@ | |||
| 7 | 7 | ||
| 8 | use defmt::info; | 8 | use defmt::info; |
| 9 | use embassy_executor::Spawner; | 9 | use embassy_executor::Spawner; |
| 10 | use embassy_lora::iv::Stm32wlInterfaceVariant; | 10 | use embassy_lora::iv::{InterruptHandler, Stm32wlInterfaceVariant}; |
| 11 | use embassy_stm32::bind_interrupts; | ||
| 11 | use embassy_stm32::gpio::{Level, Output, Pin, Speed}; | 12 | use embassy_stm32::gpio::{Level, Output, Pin, Speed}; |
| 12 | use embassy_stm32::spi::Spi; | 13 | use embassy_stm32::spi::Spi; |
| 13 | use embassy_stm32::{interrupt, into_ref, Peripheral}; | ||
| 14 | use embassy_time::Delay; | 14 | use embassy_time::Delay; |
| 15 | use lora_phy::mod_params::*; | 15 | use lora_phy::mod_params::*; |
| 16 | use lora_phy::sx1261_2::SX1261_2; | 16 | use lora_phy::sx1261_2::SX1261_2; |
| @@ -19,6 +19,10 @@ use {defmt_rtt as _, panic_probe as _}; | |||
| 19 | 19 | ||
| 20 | const LORA_FREQUENCY_IN_HZ: u32 = 903_900_000; // warning: set this appropriately for the region | 20 | const LORA_FREQUENCY_IN_HZ: u32 = 903_900_000; // warning: set this appropriately for the region |
| 21 | 21 | ||
| 22 | bind_interrupts!(struct Irqs{ | ||
| 23 | SUBGHZ_RADIO => InterruptHandler; | ||
| 24 | }); | ||
| 25 | |||
| 22 | #[embassy_executor::main] | 26 | #[embassy_executor::main] |
| 23 | async fn main(_spawner: Spawner) { | 27 | async fn main(_spawner: Spawner) { |
| 24 | let mut config = embassy_stm32::Config::default(); | 28 | let mut config = embassy_stm32::Config::default(); |
| @@ -27,13 +31,11 @@ async fn main(_spawner: Spawner) { | |||
| 27 | 31 | ||
| 28 | let spi = Spi::new_subghz(p.SUBGHZSPI, p.DMA1_CH1, p.DMA1_CH2); | 32 | let spi = Spi::new_subghz(p.SUBGHZSPI, p.DMA1_CH1, p.DMA1_CH2); |
| 29 | 33 | ||
| 30 | let irq = interrupt::take!(SUBGHZ_RADIO); | ||
| 31 | into_ref!(irq); | ||
| 32 | // Set CTRL1 and CTRL3 for high-power transmission, while CTRL2 acts as an RF switch between tx and rx | 34 | // Set CTRL1 and CTRL3 for high-power transmission, while CTRL2 acts as an RF switch between tx and rx |
| 33 | let _ctrl1 = Output::new(p.PC4.degrade(), Level::Low, Speed::High); | 35 | let _ctrl1 = Output::new(p.PC4.degrade(), Level::Low, Speed::High); |
| 34 | let ctrl2 = Output::new(p.PC5.degrade(), Level::High, Speed::High); | 36 | let ctrl2 = Output::new(p.PC5.degrade(), Level::High, Speed::High); |
| 35 | let _ctrl3 = Output::new(p.PC3.degrade(), Level::High, Speed::High); | 37 | let _ctrl3 = Output::new(p.PC3.degrade(), Level::High, Speed::High); |
| 36 | let iv = Stm32wlInterfaceVariant::new(irq, None, Some(ctrl2)).unwrap(); | 38 | let iv = Stm32wlInterfaceVariant::new(Irqs, None, Some(ctrl2)).unwrap(); |
| 37 | 39 | ||
| 38 | let mut delay = Delay; | 40 | let mut delay = Delay; |
| 39 | 41 | ||
diff --git a/examples/stm32wl/src/bin/uart_async.rs b/examples/stm32wl/src/bin/uart_async.rs index ac8766af6..07b0f9d2c 100644 --- a/examples/stm32wl/src/bin/uart_async.rs +++ b/examples/stm32wl/src/bin/uart_async.rs | |||
| @@ -4,10 +4,15 @@ | |||
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy_executor::Spawner; | 6 | use embassy_executor::Spawner; |
| 7 | use embassy_stm32::interrupt; | 7 | use embassy_stm32::usart::{Config, InterruptHandler, Uart}; |
| 8 | use embassy_stm32::usart::{Config, Uart}; | 8 | use embassy_stm32::{bind_interrupts, peripherals}; |
| 9 | use {defmt_rtt as _, panic_probe as _}; | 9 | use {defmt_rtt as _, panic_probe as _}; |
| 10 | 10 | ||
| 11 | bind_interrupts!(struct Irqs{ | ||
| 12 | USART1 => InterruptHandler<peripherals::USART1>; | ||
| 13 | LPUART1 => InterruptHandler<peripherals::LPUART1>; | ||
| 14 | }); | ||
| 15 | |||
| 11 | /* | 16 | /* |
| 12 | Pass Incoming data from LPUART1 to USART1 | 17 | Pass Incoming data from LPUART1 to USART1 |
| 13 | Example is written for the LoRa-E5 mini v1.0, | 18 | Example is written for the LoRa-E5 mini v1.0, |
| @@ -28,12 +33,10 @@ async fn main(_spawner: Spawner) { | |||
| 28 | config2.baudrate = 9600; | 33 | config2.baudrate = 9600; |
| 29 | 34 | ||
| 30 | //RX/TX connected to USB/UART Bridge on LoRa-E5 mini v1.0 | 35 | //RX/TX connected to USB/UART Bridge on LoRa-E5 mini v1.0 |
| 31 | let irq = interrupt::take!(USART1); | 36 | let mut usart1 = Uart::new(p.USART1, p.PB7, p.PB6, Irqs, p.DMA1_CH3, p.DMA1_CH4, config1); |
| 32 | let mut usart1 = Uart::new(p.USART1, p.PB7, p.PB6, irq, p.DMA1_CH3, p.DMA1_CH4, config1); | ||
| 33 | 37 | ||
| 34 | //RX1/TX1 (LPUART) on LoRa-E5 mini v1.0 | 38 | //RX1/TX1 (LPUART) on LoRa-E5 mini v1.0 |
| 35 | let irq = interrupt::take!(LPUART1); | 39 | let mut usart2 = Uart::new(p.LPUART1, p.PC0, p.PC1, Irqs, p.DMA1_CH5, p.DMA1_CH6, config2); |
| 36 | let mut usart2 = Uart::new(p.LPUART1, p.PC0, p.PC1, irq, p.DMA1_CH5, p.DMA1_CH6, config2); | ||
| 37 | 40 | ||
| 38 | unwrap!(usart1.write(b"Hello Embassy World!\r\n").await); | 41 | unwrap!(usart1.write(b"Hello Embassy World!\r\n").await); |
| 39 | unwrap!(usart2.write(b"Hello Embassy World!\r\n").await); | 42 | unwrap!(usart2.write(b"Hello Embassy World!\r\n").await); |
