aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2023-05-11 22:48:55 +0000
committerGitHub <[email protected]>2023-05-11 22:48:55 +0000
commit7f96359804b5f2bb3248cb7c0e1bab30e9135a41 (patch)
tree153a60a3813fce4335fada366ecea76d1735aec2 /tests
parente179e7cf85810f0aa7ef8027d8d48f6d21f64dac (diff)
parentbf45b1d83dba837dabc63361dc472902ab82cda4 (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.toml6
-rw-r--r--tests/stm32/src/bin/ble.rs51
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
19sdmmc = [] 19sdmmc = []
20chrono = ["embassy-stm32/chrono", "dep:chrono"] 20chrono = ["embassy-stm32/chrono", "dep:chrono"]
21ble = []
21not-gpdma = [] 22not-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]]
48name = "ble"
49path = "src/bin/ble.rs"
50required-features = [ "ble",]
51
52[[bin]]
47name = "gpio" 53name = "gpio"
48path = "src/bin/gpio.rs" 54path = "src/bin/gpio.rs"
49required-features = [] 55required-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"]
8mod example_common;
9use embassy_executor::Spawner;
10use embassy_stm32::ipcc::{Config, Ipcc};
11use embassy_stm32::tl_mbox::TlMbox;
12use embassy_time::{Duration, Timer};
13use example_common::*;
14
15#[embassy_executor::main]
16async 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}