aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorgoueslati <[email protected]>2023-05-26 09:56:55 +0100
committergoueslati <[email protected]>2023-05-26 09:56:55 +0100
commit2ccf9f3abd6c8ccde0e56f97cbe65e5fb4bc32ce (patch)
tree6cfef925e9d30fd4ec947076ef88f4a32f2c30cc /examples
parent524a89cc722d2f01e1edcceb8ed116c5f2e12885 (diff)
stm32/ipcc: static methods for IPCC
Diffstat (limited to 'examples')
-rw-r--r--examples/stm32wb/src/bin/tl_mbox.rs8
-rw-r--r--examples/stm32wb/src/bin/tl_mbox_tx_rx.rs21
2 files changed, 13 insertions, 16 deletions
diff --git a/examples/stm32wb/src/bin/tl_mbox.rs b/examples/stm32wb/src/bin/tl_mbox.rs
index 326e4be85..18d93a279 100644
--- a/examples/stm32wb/src/bin/tl_mbox.rs
+++ b/examples/stm32wb/src/bin/tl_mbox.rs
@@ -4,7 +4,7 @@
4 4
5use defmt::*; 5use defmt::*;
6use embassy_executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_stm32::ipcc::{Config, Ipcc}; 7use embassy_stm32::ipcc::Config;
8use embassy_stm32::tl_mbox::TlMbox; 8use embassy_stm32::tl_mbox::TlMbox;
9use embassy_stm32::{bind_interrupts, tl_mbox}; 9use embassy_stm32::{bind_interrupts, tl_mbox};
10use embassy_time::{Duration, Timer}; 10use embassy_time::{Duration, Timer};
@@ -41,13 +41,11 @@ 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. 41 Note: extended stack versions are not supported at this time. Do not attempt to install a stack with "extended" in the name.
42 */ 42 */
43 43
44 let p = embassy_stm32::init(Default::default()); 44 let _p = embassy_stm32::init(Default::default());
45 info!("Hello World!"); 45 info!("Hello World!");
46 46
47 let config = Config::default(); 47 let config = Config::default();
48 let mut ipcc = Ipcc::new(p.IPCC, config); 48 let mbox = TlMbox::init(Irqs, config);
49
50 let mbox = TlMbox::init(&mut ipcc, Irqs);
51 49
52 loop { 50 loop {
53 let wireless_fw_info = mbox.wireless_fw_info(); 51 let wireless_fw_info = mbox.wireless_fw_info();
diff --git a/examples/stm32wb/src/bin/tl_mbox_tx_rx.rs b/examples/stm32wb/src/bin/tl_mbox_tx_rx.rs
index 7a69f26b7..41c450a53 100644
--- a/examples/stm32wb/src/bin/tl_mbox_tx_rx.rs
+++ b/examples/stm32wb/src/bin/tl_mbox_tx_rx.rs
@@ -4,7 +4,7 @@
4 4
5use defmt::*; 5use defmt::*;
6use embassy_executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_stm32::ipcc::{Config, Ipcc}; 7use embassy_stm32::ipcc::Config;
8use embassy_stm32::tl_mbox::TlMbox; 8use embassy_stm32::tl_mbox::TlMbox;
9use embassy_stm32::{bind_interrupts, tl_mbox}; 9use embassy_stm32::{bind_interrupts, tl_mbox};
10use {defmt_rtt as _, panic_probe as _}; 10use {defmt_rtt as _, panic_probe as _};
@@ -40,16 +40,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. 40 Note: extended stack versions are not supported at this time. Do not attempt to install a stack with "extended" in the name.
41 */ 41 */
42 42
43 let p = embassy_stm32::init(Default::default()); 43 let _p = embassy_stm32::init(Default::default());
44 info!("Hello World!"); 44 info!("Hello World!");
45 45
46 let config = Config::default(); 46 let config = Config::default();
47 let mut ipcc = Ipcc::new(p.IPCC, config); 47 let mbox = TlMbox::init(Irqs, config);
48
49 let mbox = TlMbox::init(&mut ipcc, Irqs);
50
51 // initialize ble stack, does not return a response
52 mbox.shci_ble_init(&mut ipcc, Default::default());
53 48
54 info!("waiting for coprocessor to boot"); 49 info!("waiting for coprocessor to boot");
55 let event_box = mbox.read().await; 50 let event_box = mbox.read().await;
@@ -74,10 +69,11 @@ async fn main(_spawner: Spawner) {
74 ); 69 );
75 } 70 }
76 71
77 mbox.shci_ble_init(&mut ipcc, Default::default()); 72 // initialize ble stack, does not return a response
73 mbox.shci_ble_init(Default::default());
78 74
79 info!("resetting BLE"); 75 info!("resetting BLE");
80 mbox.send_ble_cmd(&mut ipcc, &[0x01, 0x03, 0x0c, 0x00, 0x00]); 76 mbox.send_ble_cmd(&[0x01, 0x03, 0x0c, 0x00, 0x00]);
81 77
82 let event_box = mbox.read().await; 78 let event_box = mbox.read().await;
83 79
@@ -92,7 +88,10 @@ async fn main(_spawner: Spawner) {
92 88
93 info!( 89 info!(
94 "==> kind: {:#04x}, code: {:#04x}, payload_length: {}, payload: {:#04x}", 90 "==> kind: {:#04x}, code: {:#04x}, payload_length: {}, payload: {:#04x}",
95 kind, code, payload_len, payload 91 kind,
92 code,
93 payload_len,
94 payload[3..]
96 ); 95 );
97 96
98 loop {} 97 loop {}