diff options
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/stm32wb/src/bin/tl_mbox.rs | 5 | ||||
| -rw-r--r-- | examples/stm32wb/src/bin/tl_mbox_tx_rx.rs | 26 |
2 files changed, 18 insertions, 13 deletions
diff --git a/examples/stm32wb/src/bin/tl_mbox.rs b/examples/stm32wb/src/bin/tl_mbox.rs index ae36a7e79..a28a8e21b 100644 --- a/examples/stm32wb/src/bin/tl_mbox.rs +++ b/examples/stm32wb/src/bin/tl_mbox.rs | |||
| @@ -6,13 +6,14 @@ use defmt::*; | |||
| 6 | use embassy_executor::Spawner; | 6 | use embassy_executor::Spawner; |
| 7 | use embassy_stm32::bind_interrupts; | 7 | use embassy_stm32::bind_interrupts; |
| 8 | use embassy_stm32::ipcc::Config; | 8 | use embassy_stm32::ipcc::Config; |
| 9 | use embassy_stm32::ipcc::{ReceiveInterruptHandler, TransmitInterruptHandler}; | ||
| 9 | use embassy_stm32_wpan::TlMbox; | 10 | use embassy_stm32_wpan::TlMbox; |
| 10 | use embassy_time::{Duration, Timer}; | 11 | use embassy_time::{Duration, Timer}; |
| 11 | use {defmt_rtt as _, panic_probe as _}; | 12 | use {defmt_rtt as _, panic_probe as _}; |
| 12 | 13 | ||
| 13 | bind_interrupts!(struct Irqs{ | 14 | bind_interrupts!(struct Irqs{ |
| 14 | IPCC_C1_RX => embassy_stm32_wpan::ReceiveInterruptHandler; | 15 | IPCC_C1_RX => ReceiveInterruptHandler; |
| 15 | IPCC_C1_TX => embassy_stm32_wpan::TransmitInterruptHandler; | 16 | IPCC_C1_TX => TransmitInterruptHandler; |
| 16 | }); | 17 | }); |
| 17 | 18 | ||
| 18 | #[embassy_executor::main] | 19 | #[embassy_executor::main] |
diff --git a/examples/stm32wb/src/bin/tl_mbox_tx_rx.rs b/examples/stm32wb/src/bin/tl_mbox_tx_rx.rs index 3132ab3e4..91a0f9c0a 100644 --- a/examples/stm32wb/src/bin/tl_mbox_tx_rx.rs +++ b/examples/stm32wb/src/bin/tl_mbox_tx_rx.rs | |||
| @@ -5,14 +5,15 @@ | |||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy_executor::Spawner; | 6 | use embassy_executor::Spawner; |
| 7 | use embassy_stm32::bind_interrupts; | 7 | use embassy_stm32::bind_interrupts; |
| 8 | use embassy_stm32::ipcc::Config; | 8 | use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler}; |
| 9 | use embassy_stm32_wpan::rc::RadioCoprocessor; | 9 | use embassy_stm32_wpan::ble::Ble; |
| 10 | use embassy_stm32_wpan::sys::Sys; | ||
| 10 | use embassy_stm32_wpan::TlMbox; | 11 | use embassy_stm32_wpan::TlMbox; |
| 11 | use {defmt_rtt as _, panic_probe as _}; | 12 | use {defmt_rtt as _, panic_probe as _}; |
| 12 | 13 | ||
| 13 | bind_interrupts!(struct Irqs{ | 14 | bind_interrupts!(struct Irqs{ |
| 14 | IPCC_C1_RX => embassy_stm32_wpan::ReceiveInterruptHandler; | 15 | IPCC_C1_RX => ReceiveInterruptHandler; |
| 15 | IPCC_C1_TX => embassy_stm32_wpan::TransmitInterruptHandler; | 16 | IPCC_C1_TX => TransmitInterruptHandler; |
| 16 | }); | 17 | }); |
| 17 | 18 | ||
| 18 | #[embassy_executor::main] | 19 | #[embassy_executor::main] |
| @@ -45,16 +46,19 @@ async fn main(_spawner: Spawner) { | |||
| 45 | info!("Hello World!"); | 46 | info!("Hello World!"); |
| 46 | 47 | ||
| 47 | let config = Config::default(); | 48 | let config = Config::default(); |
| 48 | let mbox = TlMbox::init(p.IPCC, Irqs, config); | 49 | let _ = TlMbox::init(p.IPCC, Irqs, config); |
| 49 | 50 | ||
| 50 | let mut rc = RadioCoprocessor::new(mbox); | 51 | let mut rx_buf = [0u8; 500]; |
| 52 | Sys::shci_c2_ble_init(Default::default()).await; | ||
| 51 | 53 | ||
| 52 | let response = rc.read().await; | 54 | info!("starting ble..."); |
| 53 | info!("coprocessor ready {}", response); | 55 | Ble::write(0x0c, &[]).await; |
| 54 | 56 | ||
| 55 | rc.write(&[0x01, 0x03, 0x0c, 0x00, 0x00]); | 57 | info!("waiting for ble..."); |
| 56 | let response = rc.read().await; | 58 | let ble_event = Ble::read().await; |
| 57 | info!("ble reset rsp {}", response); | 59 | ble_event.write(&mut rx_buf).unwrap(); |
| 60 | |||
| 61 | info!("ble event: {}", rx_buf); | ||
| 58 | 62 | ||
| 59 | info!("Test OK"); | 63 | info!("Test OK"); |
| 60 | cortex_m::asm::bkpt(); | 64 | cortex_m::asm::bkpt(); |
