aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorxoviat <[email protected]>2023-05-27 15:05:50 -0500
committerxoviat <[email protected]>2023-05-27 15:05:50 -0500
commit09d52638b551a37c8b032ffb6daaa1abd2efa231 (patch)
tree13f630e6ced8e55ade446fbf693e3745d0bed0f1 /examples
parent37e104a6b380c3c7ec20346a44b11050476a6116 (diff)
stm32/ipcc: refactor examples and tests
Diffstat (limited to 'examples')
-rw-r--r--examples/stm32wb/src/bin/tl_mbox.rs14
-rw-r--r--examples/stm32wb/src/bin/tl_mbox_tx_rx.rs10
2 files changed, 13 insertions, 11 deletions
diff --git a/examples/stm32wb/src/bin/tl_mbox.rs b/examples/stm32wb/src/bin/tl_mbox.rs
index 18d93a279..8f4e70af0 100644
--- a/examples/stm32wb/src/bin/tl_mbox.rs
+++ b/examples/stm32wb/src/bin/tl_mbox.rs
@@ -4,8 +4,7 @@
4 4
5use defmt::*; 5use defmt::*;
6use embassy_executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_stm32::ipcc::Config; 7use embassy_stm32::tl_mbox::{Config, TlMbox};
8use embassy_stm32::tl_mbox::TlMbox;
9use embassy_stm32::{bind_interrupts, tl_mbox}; 8use embassy_stm32::{bind_interrupts, tl_mbox};
10use embassy_time::{Duration, Timer}; 9use embassy_time::{Duration, Timer};
11use {defmt_rtt as _, panic_probe as _}; 10use {defmt_rtt as _, panic_probe as _};
@@ -41,16 +40,16 @@ async fn main(_spawner: Spawner) {
41 Note: extended stack versions are not supported at this time. Do not attempt to install a stack with "extended" in the name. 40 Note: extended stack versions are not supported at this time. Do not attempt to install a stack with "extended" in the name.
42 */ 41 */
43 42
44 let _p = embassy_stm32::init(Default::default()); 43 let p = embassy_stm32::init(Default::default());
45 info!("Hello World!"); 44 info!("Hello World!");
46 45
47 let config = Config::default(); 46 let config = Config::default();
48 let mbox = TlMbox::init(Irqs, config); 47 let mbox = TlMbox::new(p.IPCC, Irqs, config);
49 48
50 loop { 49 loop {
51 let wireless_fw_info = mbox.wireless_fw_info(); 50 let wireless_fw_info = mbox.wireless_fw_info();
52 match wireless_fw_info { 51 match wireless_fw_info {
53 None => error!("not yet initialized"), 52 None => info!("not yet initialized"),
54 Some(fw_info) => { 53 Some(fw_info) => {
55 let version_major = fw_info.version_major(); 54 let version_major = fw_info.version_major();
56 let version_minor = fw_info.version_minor(); 55 let version_minor = fw_info.version_minor();
@@ -68,6 +67,9 @@ async fn main(_spawner: Spawner) {
68 } 67 }
69 } 68 }
70 69
71 Timer::after(Duration::from_millis(500)).await; 70 Timer::after(Duration::from_millis(50)).await;
72 } 71 }
72
73 info!("Test OK");
74 cortex_m::asm::bkpt();
73} 75}
diff --git a/examples/stm32wb/src/bin/tl_mbox_tx_rx.rs b/examples/stm32wb/src/bin/tl_mbox_tx_rx.rs
index 41c450a53..1724d946f 100644
--- a/examples/stm32wb/src/bin/tl_mbox_tx_rx.rs
+++ b/examples/stm32wb/src/bin/tl_mbox_tx_rx.rs
@@ -4,8 +4,7 @@
4 4
5use defmt::*; 5use defmt::*;
6use embassy_executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_stm32::ipcc::Config; 7use embassy_stm32::tl_mbox::{Config, TlMbox};
8use embassy_stm32::tl_mbox::TlMbox;
9use embassy_stm32::{bind_interrupts, tl_mbox}; 8use embassy_stm32::{bind_interrupts, tl_mbox};
10use {defmt_rtt as _, panic_probe as _}; 9use {defmt_rtt as _, panic_probe as _};
11 10
@@ -40,11 +39,11 @@ async fn main(_spawner: Spawner) {
40 Note: extended stack versions are not supported at this time. Do not attempt to install a stack with "extended" in the name. 39 Note: extended stack versions are not supported at this time. Do not attempt to install a stack with "extended" in the name.
41 */ 40 */
42 41
43 let _p = embassy_stm32::init(Default::default()); 42 let p = embassy_stm32::init(Default::default());
44 info!("Hello World!"); 43 info!("Hello World!");
45 44
46 let config = Config::default(); 45 let config = Config::default();
47 let mbox = TlMbox::init(Irqs, config); 46 let mbox = TlMbox::new(p.IPCC, Irqs, config);
48 47
49 info!("waiting for coprocessor to boot"); 48 info!("waiting for coprocessor to boot");
50 let event_box = mbox.read().await; 49 let event_box = mbox.read().await;
@@ -94,5 +93,6 @@ async fn main(_spawner: Spawner) {
94 payload[3..] 93 payload[3..]
95 ); 94 );
96 95
97 loop {} 96 info!("Test OK");
97 cortex_m::asm::bkpt();
98} 98}