diff --git a/examples/stm32wb/src/bin/tl_mbox.rs b/examples/stm32wb/src/bin/tl_mbox.rs index ee090e6e..6a9b9c93 100644 --- a/examples/stm32wb/src/bin/tl_mbox.rs +++ b/examples/stm32wb/src/bin/tl_mbox.rs @@ -39,6 +39,4 @@ async fn main(_spawner: Spawner) { } } } - - loop {} } diff --git a/tests/stm32/Cargo.toml b/tests/stm32/Cargo.toml index 5cd94966..03ddd3d0 100644 --- a/tests/stm32/Cargo.toml +++ b/tests/stm32/Cargo.toml @@ -11,12 +11,13 @@ stm32g071rb = ["embassy-stm32/stm32g071rb", "not-gpdma"] # Nucleo stm32c031c6 = ["embassy-stm32/stm32c031c6", "not-gpdma"] # Nucleo stm32g491re = ["embassy-stm32/stm32g491re", "not-gpdma"] # Nucleo stm32h755zi = ["embassy-stm32/stm32h755zi-cm7", "not-gpdma"] # Nucleo -stm32wb55rg = ["embassy-stm32/stm32wb55rg", "not-gpdma"] # Nucleo +stm32wb55rg = ["embassy-stm32/stm32wb55rg", "ble", "not-gpdma"] # Nucleo stm32h563zi = ["embassy-stm32/stm32h563zi"] # Nucleo stm32u585ai = ["embassy-stm32/stm32u585ai"] # IoT board sdmmc = [] chrono = ["embassy-stm32/chrono", "dep:chrono"] +ble = [] not-gpdma = [] [dependencies] @@ -42,6 +43,11 @@ chrono = { version = "^0.4", default-features = false, optional = true} # BEGIN TESTS # Generated by gen_test.py. DO NOT EDIT. +[[bin]] +name = "ble" +path = "src/bin/ble.rs" +required-features = [ "ble",] + [[bin]] name = "gpio" path = "src/bin/gpio.rs" diff --git a/tests/stm32/src/bin/ble.rs b/tests/stm32/src/bin/ble.rs new file mode 100644 index 00000000..f4c864c6 --- /dev/null +++ b/tests/stm32/src/bin/ble.rs @@ -0,0 +1,51 @@ +#![no_std] +#![no_main] +#![feature(type_alias_impl_trait)] + +// required-features: ble + +#[path = "../example_common.rs"] +mod example_common; +use embassy_executor::Spawner; +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); + + let mbox = TlMbox::init(&mut ipcc); + + loop { + let wireless_fw_info = mbox.wireless_fw_info(); + match wireless_fw_info { + None => error!("not yet initialized"), + 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; + } + } + + Timer::after(Duration::from_millis(500)).await; + } + + info!("Test OK"); + cortex_m::asm::bkpt(); +}