diff options
| author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2023-05-11 22:48:55 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-05-11 22:48:55 +0000 |
| commit | 7f96359804b5f2bb3248cb7c0e1bab30e9135a41 (patch) | |
| tree | 153a60a3813fce4335fada366ecea76d1735aec2 /tests | |
| parent | e179e7cf85810f0aa7ef8027d8d48f6d21f64dac (diff) | |
| parent | bf45b1d83dba837dabc63361dc472902ab82cda4 (diff) | |
Merge #1424
1424: add TL maibox for stm32wb r=xoviat a=OueslatiGhaith
Hello,
This pull request is related to #1397 and #1401, inspired by #24, build upon the work done in #1405, and was tested on an stm32wb55rg.
This pull request aims to add the transport layer mailbox for stm32wb microcontrollers. For now it's only capable of initializing it and getting the firmware information
Co-authored-by: goueslati <[email protected]>
Co-authored-by: Ghaith Oueslati <[email protected]>
Co-authored-by: xoviat <[email protected]>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/stm32/Cargo.toml | 6 | ||||
| -rw-r--r-- | tests/stm32/src/bin/ble.rs | 51 |
2 files changed, 57 insertions, 0 deletions
diff --git a/tests/stm32/Cargo.toml b/tests/stm32/Cargo.toml index 83bf1e9c9..bd8d90abe 100644 --- a/tests/stm32/Cargo.toml +++ b/tests/stm32/Cargo.toml | |||
| @@ -18,6 +18,7 @@ stm32u585ai = ["embassy-stm32/stm32u585ai"] # IoT board | |||
| 18 | 18 | ||
| 19 | sdmmc = [] | 19 | sdmmc = [] |
| 20 | chrono = ["embassy-stm32/chrono", "dep:chrono"] | 20 | chrono = ["embassy-stm32/chrono", "dep:chrono"] |
| 21 | ble = [] | ||
| 21 | not-gpdma = [] | 22 | not-gpdma = [] |
| 22 | 23 | ||
| 23 | [dependencies] | 24 | [dependencies] |
| @@ -44,6 +45,11 @@ chrono = { version = "^0.4", default-features = false, optional = true} | |||
| 44 | # BEGIN TESTS | 45 | # BEGIN TESTS |
| 45 | # Generated by gen_test.py. DO NOT EDIT. | 46 | # Generated by gen_test.py. DO NOT EDIT. |
| 46 | [[bin]] | 47 | [[bin]] |
| 48 | name = "ble" | ||
| 49 | path = "src/bin/ble.rs" | ||
| 50 | required-features = [ "ble",] | ||
| 51 | |||
| 52 | [[bin]] | ||
| 47 | name = "gpio" | 53 | name = "gpio" |
| 48 | path = "src/bin/gpio.rs" | 54 | path = "src/bin/gpio.rs" |
| 49 | required-features = [] | 55 | required-features = [] |
diff --git a/tests/stm32/src/bin/ble.rs b/tests/stm32/src/bin/ble.rs new file mode 100644 index 000000000..f4c864c65 --- /dev/null +++ b/tests/stm32/src/bin/ble.rs | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | #![no_std] | ||
| 2 | #![no_main] | ||
| 3 | #![feature(type_alias_impl_trait)] | ||
| 4 | |||
| 5 | // required-features: ble | ||
| 6 | |||
| 7 | #[path = "../example_common.rs"] | ||
| 8 | mod example_common; | ||
| 9 | use embassy_executor::Spawner; | ||
| 10 | use embassy_stm32::ipcc::{Config, Ipcc}; | ||
| 11 | use embassy_stm32::tl_mbox::TlMbox; | ||
| 12 | use embassy_time::{Duration, Timer}; | ||
| 13 | use example_common::*; | ||
| 14 | |||
| 15 | #[embassy_executor::main] | ||
| 16 | async fn main(_spawner: Spawner) { | ||
| 17 | let p = embassy_stm32::init(config()); | ||
| 18 | info!("Hello World!"); | ||
| 19 | |||
| 20 | let config = Config::default(); | ||
| 21 | let mut ipcc = Ipcc::new(p.IPCC, config); | ||
| 22 | |||
| 23 | let mbox = TlMbox::init(&mut ipcc); | ||
| 24 | |||
| 25 | loop { | ||
| 26 | let wireless_fw_info = mbox.wireless_fw_info(); | ||
| 27 | match wireless_fw_info { | ||
| 28 | None => error!("not yet initialized"), | ||
| 29 | Some(fw_info) => { | ||
| 30 | let version_major = fw_info.version_major(); | ||
| 31 | let version_minor = fw_info.version_minor(); | ||
| 32 | let subversion = fw_info.subversion(); | ||
| 33 | |||
| 34 | let sram2a_size = fw_info.sram2a_size(); | ||
| 35 | let sram2b_size = fw_info.sram2b_size(); | ||
| 36 | |||
| 37 | info!( | ||
| 38 | "version {}.{}.{} - SRAM2a {} - SRAM2b {}", | ||
| 39 | version_major, version_minor, subversion, sram2a_size, sram2b_size | ||
| 40 | ); | ||
| 41 | |||
| 42 | break; | ||
| 43 | } | ||
| 44 | } | ||
| 45 | |||
| 46 | Timer::after(Duration::from_millis(500)).await; | ||
| 47 | } | ||
| 48 | |||
| 49 | info!("Test OK"); | ||
| 50 | cortex_m::asm::bkpt(); | ||
| 51 | } | ||
