diff options
| author | goueslati <[email protected]> | 2023-05-02 12:16:48 +0100 |
|---|---|---|
| committer | goueslati <[email protected]> | 2023-05-02 12:16:48 +0100 |
| commit | bab30a7e876e0c7f98e1c1f39a7d2494de5daece (patch) | |
| tree | 0af0f15a96335eaaae578fe7dd6065e131b1b0b8 /examples/stm32wb/src/bin/tl_mbox.rs | |
| parent | 6096f0cf4b5ef45b97665166be41bfd490748f40 (diff) | |
added TL Mailbox initialization for STM32WB
Diffstat (limited to 'examples/stm32wb/src/bin/tl_mbox.rs')
| -rw-r--r-- | examples/stm32wb/src/bin/tl_mbox.rs | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/examples/stm32wb/src/bin/tl_mbox.rs b/examples/stm32wb/src/bin/tl_mbox.rs new file mode 100644 index 000000000..ee090e6eb --- /dev/null +++ b/examples/stm32wb/src/bin/tl_mbox.rs | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | #![no_std] | ||
| 2 | #![no_main] | ||
| 3 | #![feature(type_alias_impl_trait)] | ||
| 4 | |||
| 5 | use defmt::*; | ||
| 6 | use embassy_executor::Spawner; | ||
| 7 | use embassy_stm32::ipcc::{Config, Ipcc}; | ||
| 8 | use embassy_stm32::tl_mbox::TlMbox; | ||
| 9 | use {defmt_rtt as _, panic_probe as _}; | ||
| 10 | |||
| 11 | #[embassy_executor::main] | ||
| 12 | async fn main(_spawner: Spawner) { | ||
| 13 | let p = embassy_stm32::init(Default::default()); | ||
| 14 | info!("Hello World!"); | ||
| 15 | |||
| 16 | let config = Config::default(); | ||
| 17 | let mut ipcc = Ipcc::new(p.IPCC, config); | ||
| 18 | |||
| 19 | let mbox = TlMbox::init(&mut ipcc); | ||
| 20 | |||
| 21 | loop { | ||
| 22 | let wireless_fw_info = mbox.wireless_fw_info(); | ||
| 23 | match wireless_fw_info { | ||
| 24 | None => error!("not yet initialized"), | ||
| 25 | Some(fw_info) => { | ||
| 26 | let version_major = fw_info.version_major(); | ||
| 27 | let version_minor = fw_info.version_minor(); | ||
| 28 | let subversion = fw_info.subversion(); | ||
| 29 | |||
| 30 | let sram2a_size = fw_info.sram2a_size(); | ||
| 31 | let sram2b_size = fw_info.sram2b_size(); | ||
| 32 | |||
| 33 | info!( | ||
| 34 | "version {}.{}.{} - SRAM2a {} - SRAM2b {}", | ||
| 35 | version_major, version_minor, subversion, sram2a_size, sram2b_size | ||
| 36 | ); | ||
| 37 | |||
| 38 | break; | ||
| 39 | } | ||
| 40 | } | ||
| 41 | } | ||
| 42 | |||
| 43 | loop {} | ||
| 44 | } | ||
