embassy/tests/stm32/src/bin/ble.rs

56 lines
1.5 KiB
Rust
Raw Normal View History

2023-05-04 00:36:31 +02:00
#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
// required-features: ble
#[path = "../example_common.rs"]
mod example_common;
use embassy_executor::Spawner;
2023-05-26 11:03:01 +02:00
use embassy_stm32::ipcc::Config;
2023-05-04 00:36:31 +02:00
use embassy_stm32::tl_mbox::TlMbox;
2023-05-26 11:03:01 +02:00
use embassy_stm32::{bind_interrupts, tl_mbox};
2023-05-04 00:36:31 +02:00
use embassy_time::{Duration, Timer};
use example_common::*;
2023-05-26 11:03:01 +02:00
bind_interrupts!(struct Irqs{
IPCC_C1_RX => tl_mbox::ReceiveInterruptHandler;
IPCC_C1_TX => tl_mbox::TransmitInterruptHandler;
});
2023-05-04 00:36:31 +02:00
#[embassy_executor::main]
async fn main(_spawner: Spawner) {
2023-05-26 11:03:01 +02:00
let _p = embassy_stm32::init(config());
2023-05-04 00:36:31 +02:00
info!("Hello World!");
let config = Config::default();
2023-05-26 11:03:01 +02:00
let mbox = TlMbox::init(Irqs, config);
2023-05-04 00:36:31 +02:00
loop {
let wireless_fw_info = mbox.wireless_fw_info();
match wireless_fw_info {
2023-05-22 03:18:26 +02:00
None => {}
2023-05-04 00:36:31 +02:00
Some(fw_info) => {
let version_major = fw_info.version_major();
let version_minor = fw_info.version_minor();
let subversion = fw_info.subversion();
let sram2a_size = fw_info.sram2a_size();
let sram2b_size = fw_info.sram2b_size();
info!(
"version {}.{}.{} - SRAM2a {} - SRAM2b {}",
version_major, version_minor, subversion, sram2a_size, sram2b_size
);
break;
}
}
2023-05-22 03:18:26 +02:00
Timer::after(Duration::from_millis(50)).await;
2023-05-04 00:36:31 +02:00
}
info!("Test OK");
cortex_m::asm::bkpt();
}