aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorxoviat <[email protected]>2023-05-03 17:36:31 -0500
committerxoviat <[email protected]>2023-05-03 17:36:31 -0500
commita0b1299890425908fb7f5c2f8c26c3f0e125a5fb (patch)
tree62a15e30aee37c334419fe7cee60d9966173d8e4 /tests
parent0997021a0585271ef6677659764e7c2bed84faea (diff)
stm32/tests: add hil test for ble
Diffstat (limited to 'tests')
-rw-r--r--tests/stm32/Cargo.toml8
-rw-r--r--tests/stm32/src/bin/ble.rs51
2 files changed, 58 insertions, 1 deletions
diff --git a/tests/stm32/Cargo.toml b/tests/stm32/Cargo.toml
index 5cd949661..03ddd3d0e 100644
--- a/tests/stm32/Cargo.toml
+++ b/tests/stm32/Cargo.toml
@@ -11,12 +11,13 @@ stm32g071rb = ["embassy-stm32/stm32g071rb", "not-gpdma"] # Nucleo
11stm32c031c6 = ["embassy-stm32/stm32c031c6", "not-gpdma"] # Nucleo 11stm32c031c6 = ["embassy-stm32/stm32c031c6", "not-gpdma"] # Nucleo
12stm32g491re = ["embassy-stm32/stm32g491re", "not-gpdma"] # Nucleo 12stm32g491re = ["embassy-stm32/stm32g491re", "not-gpdma"] # Nucleo
13stm32h755zi = ["embassy-stm32/stm32h755zi-cm7", "not-gpdma"] # Nucleo 13stm32h755zi = ["embassy-stm32/stm32h755zi-cm7", "not-gpdma"] # Nucleo
14stm32wb55rg = ["embassy-stm32/stm32wb55rg", "not-gpdma"] # Nucleo 14stm32wb55rg = ["embassy-stm32/stm32wb55rg", "ble", "not-gpdma"] # Nucleo
15stm32h563zi = ["embassy-stm32/stm32h563zi"] # Nucleo 15stm32h563zi = ["embassy-stm32/stm32h563zi"] # Nucleo
16stm32u585ai = ["embassy-stm32/stm32u585ai"] # IoT board 16stm32u585ai = ["embassy-stm32/stm32u585ai"] # IoT board
17 17
18sdmmc = [] 18sdmmc = []
19chrono = ["embassy-stm32/chrono", "dep:chrono"] 19chrono = ["embassy-stm32/chrono", "dep:chrono"]
20ble = []
20not-gpdma = [] 21not-gpdma = []
21 22
22[dependencies] 23[dependencies]
@@ -43,6 +44,11 @@ chrono = { version = "^0.4", default-features = false, optional = true}
43# BEGIN TESTS 44# BEGIN TESTS
44# Generated by gen_test.py. DO NOT EDIT. 45# Generated by gen_test.py. DO NOT EDIT.
45[[bin]] 46[[bin]]
47name = "ble"
48path = "src/bin/ble.rs"
49required-features = [ "ble",]
50
51[[bin]]
46name = "gpio" 52name = "gpio"
47path = "src/bin/gpio.rs" 53path = "src/bin/gpio.rs"
48required-features = [] 54required-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}