aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgoueslati <[email protected]>2023-05-04 09:36:00 +0100
committergoueslati <[email protected]>2023-05-04 09:36:00 +0100
commit3e728d5e73042a78cfb091d1723e6b0c4b5a414d (patch)
tree07aa4e9acd034c8367dc995e7bdad51b9141c992
parent0997021a0585271ef6677659764e7c2bed84faea (diff)
parent7750ea65ba7a6ac766247fda22a9acefd6879a6a (diff)
Merge branch 'tl_mbox' of https://github.com/OueslatiGhaith/embassy into tl_mbox
merge
-rw-r--r--examples/stm32wb/src/bin/tl_mbox.rs2
-rw-r--r--tests/stm32/Cargo.toml8
-rw-r--r--tests/stm32/src/bin/ble.rs51
3 files changed, 58 insertions, 3 deletions
diff --git a/examples/stm32wb/src/bin/tl_mbox.rs b/examples/stm32wb/src/bin/tl_mbox.rs
index ee090e6eb..6a9b9c936 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) {
39 } 39 }
40 } 40 }
41 } 41 }
42
43 loop {}
44} 42}
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}