stm32/wpan: fix examples
This commit is contained in:
parent
faa58b9074
commit
4d2d7d7684
@ -6,13 +6,14 @@ use defmt::*;
|
|||||||
use embassy_executor::Spawner;
|
use embassy_executor::Spawner;
|
||||||
use embassy_stm32::bind_interrupts;
|
use embassy_stm32::bind_interrupts;
|
||||||
use embassy_stm32::ipcc::Config;
|
use embassy_stm32::ipcc::Config;
|
||||||
|
use embassy_stm32::ipcc::{ReceiveInterruptHandler, TransmitInterruptHandler};
|
||||||
use embassy_stm32_wpan::TlMbox;
|
use embassy_stm32_wpan::TlMbox;
|
||||||
use embassy_time::{Duration, Timer};
|
use embassy_time::{Duration, Timer};
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
bind_interrupts!(struct Irqs{
|
bind_interrupts!(struct Irqs{
|
||||||
IPCC_C1_RX => embassy_stm32_wpan::ReceiveInterruptHandler;
|
IPCC_C1_RX => ReceiveInterruptHandler;
|
||||||
IPCC_C1_TX => embassy_stm32_wpan::TransmitInterruptHandler;
|
IPCC_C1_TX => TransmitInterruptHandler;
|
||||||
});
|
});
|
||||||
|
|
||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
|
@ -5,14 +5,15 @@
|
|||||||
use defmt::*;
|
use defmt::*;
|
||||||
use embassy_executor::Spawner;
|
use embassy_executor::Spawner;
|
||||||
use embassy_stm32::bind_interrupts;
|
use embassy_stm32::bind_interrupts;
|
||||||
use embassy_stm32::ipcc::Config;
|
use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler};
|
||||||
use embassy_stm32_wpan::rc::RadioCoprocessor;
|
use embassy_stm32_wpan::ble::Ble;
|
||||||
|
use embassy_stm32_wpan::sys::Sys;
|
||||||
use embassy_stm32_wpan::TlMbox;
|
use embassy_stm32_wpan::TlMbox;
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
bind_interrupts!(struct Irqs{
|
bind_interrupts!(struct Irqs{
|
||||||
IPCC_C1_RX => embassy_stm32_wpan::ReceiveInterruptHandler;
|
IPCC_C1_RX => ReceiveInterruptHandler;
|
||||||
IPCC_C1_TX => embassy_stm32_wpan::TransmitInterruptHandler;
|
IPCC_C1_TX => TransmitInterruptHandler;
|
||||||
});
|
});
|
||||||
|
|
||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
@ -45,16 +46,19 @@ async fn main(_spawner: Spawner) {
|
|||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
|
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
let mbox = TlMbox::init(p.IPCC, Irqs, config);
|
let _ = TlMbox::init(p.IPCC, Irqs, config);
|
||||||
|
|
||||||
let mut rc = RadioCoprocessor::new(mbox);
|
let mut rx_buf = [0u8; 500];
|
||||||
|
Sys::shci_c2_ble_init(Default::default()).await;
|
||||||
|
|
||||||
let response = rc.read().await;
|
info!("starting ble...");
|
||||||
info!("coprocessor ready {}", response);
|
Ble::write(0x0c, &[]).await;
|
||||||
|
|
||||||
rc.write(&[0x01, 0x03, 0x0c, 0x00, 0x00]);
|
info!("waiting for ble...");
|
||||||
let response = rc.read().await;
|
let ble_event = Ble::read().await;
|
||||||
info!("ble reset rsp {}", response);
|
ble_event.write(&mut rx_buf).unwrap();
|
||||||
|
|
||||||
|
info!("ble event: {}", rx_buf);
|
||||||
|
|
||||||
info!("Test OK");
|
info!("Test OK");
|
||||||
cortex_m::asm::bkpt();
|
cortex_m::asm::bkpt();
|
||||||
|
Loading…
Reference in New Issue
Block a user