diff options
| author | goueslati <[email protected]> | 2023-05-04 09:36:00 +0100 |
|---|---|---|
| committer | goueslati <[email protected]> | 2023-05-04 09:36:00 +0100 |
| commit | 3e728d5e73042a78cfb091d1723e6b0c4b5a414d (patch) | |
| tree | 07aa4e9acd034c8367dc995e7bdad51b9141c992 | |
| parent | 0997021a0585271ef6677659764e7c2bed84faea (diff) | |
| parent | 7750ea65ba7a6ac766247fda22a9acefd6879a6a (diff) | |
Merge branch 'tl_mbox' of https://github.com/OueslatiGhaith/embassy into tl_mbox
merge
| -rw-r--r-- | examples/stm32wb/src/bin/tl_mbox.rs | 2 | ||||
| -rw-r--r-- | tests/stm32/Cargo.toml | 8 | ||||
| -rw-r--r-- | tests/stm32/src/bin/ble.rs | 51 |
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 | |||
| 11 | stm32c031c6 = ["embassy-stm32/stm32c031c6", "not-gpdma"] # Nucleo | 11 | stm32c031c6 = ["embassy-stm32/stm32c031c6", "not-gpdma"] # Nucleo |
| 12 | stm32g491re = ["embassy-stm32/stm32g491re", "not-gpdma"] # Nucleo | 12 | stm32g491re = ["embassy-stm32/stm32g491re", "not-gpdma"] # Nucleo |
| 13 | stm32h755zi = ["embassy-stm32/stm32h755zi-cm7", "not-gpdma"] # Nucleo | 13 | stm32h755zi = ["embassy-stm32/stm32h755zi-cm7", "not-gpdma"] # Nucleo |
| 14 | stm32wb55rg = ["embassy-stm32/stm32wb55rg", "not-gpdma"] # Nucleo | 14 | stm32wb55rg = ["embassy-stm32/stm32wb55rg", "ble", "not-gpdma"] # Nucleo |
| 15 | stm32h563zi = ["embassy-stm32/stm32h563zi"] # Nucleo | 15 | stm32h563zi = ["embassy-stm32/stm32h563zi"] # Nucleo |
| 16 | stm32u585ai = ["embassy-stm32/stm32u585ai"] # IoT board | 16 | stm32u585ai = ["embassy-stm32/stm32u585ai"] # IoT board |
| 17 | 17 | ||
| 18 | sdmmc = [] | 18 | sdmmc = [] |
| 19 | chrono = ["embassy-stm32/chrono", "dep:chrono"] | 19 | chrono = ["embassy-stm32/chrono", "dep:chrono"] |
| 20 | ble = [] | ||
| 20 | not-gpdma = [] | 21 | not-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]] |
| 47 | name = "ble" | ||
| 48 | path = "src/bin/ble.rs" | ||
| 49 | required-features = [ "ble",] | ||
| 50 | |||
| 51 | [[bin]] | ||
| 46 | name = "gpio" | 52 | name = "gpio" |
| 47 | path = "src/bin/gpio.rs" | 53 | path = "src/bin/gpio.rs" |
| 48 | required-features = [] | 54 | 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 | } | ||
