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-22 03:18:26 +02:00
use embassy_stm32::interrupt;
2023-05-04 00:36:31 +02:00
use embassy_stm32::ipcc::{Config, Ipcc};
use embassy_stm32::tl_mbox::TlMbox;
use embassy_time::{Duration, Timer};
use example_common::*;
#[embassy_executor::main]
async fn main(_spawner: Spawner) {
let p = embassy_stm32::init(config());
info!("Hello World!");
let config = Config::default();
let mut ipcc = Ipcc::new(p.IPCC, config);
2023-05-19 16:40:09 +02:00
let rx_irq = interrupt::take!(IPCC_C1_RX);
let tx_irq = interrupt::take!(IPCC_C1_TX);
let mbox = TlMbox::init(&mut ipcc, rx_irq, tx_irq);
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();
}