diff options
| author | xoviat <[email protected]> | 2023-07-16 15:09:30 -0500 |
|---|---|---|
| committer | xoviat <[email protected]> | 2023-07-16 15:09:30 -0500 |
| commit | 28b419d65ede6ff29c79dbcaa27145f1c3458a57 (patch) | |
| tree | 318a614bc7ddb86f53af7029928d96201a793f5d /tests/stm32 | |
| parent | 7c465465c1a97234c3fbeb18154bfd7f79ab07f2 (diff) | |
wpan/mac: use lifetimes to control events
Diffstat (limited to 'tests/stm32')
| -rw-r--r-- | tests/stm32/src/bin/wpan_mac.rs | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/tests/stm32/src/bin/wpan_mac.rs b/tests/stm32/src/bin/wpan_mac.rs index 2fc15dc9d..d64a5ef81 100644 --- a/tests/stm32/src/bin/wpan_mac.rs +++ b/tests/stm32/src/bin/wpan_mac.rs | |||
| @@ -55,8 +55,10 @@ async fn main(spawner: Spawner) { | |||
| 55 | }) | 55 | }) |
| 56 | .await | 56 | .await |
| 57 | .unwrap(); | 57 | .unwrap(); |
| 58 | let evt = mbox.mac_subsystem.read().await; | 58 | { |
| 59 | info!("{:#x}", evt); | 59 | let evt = mbox.mac_subsystem.read().await; |
| 60 | info!("{:#x}", evt.mac_event()); | ||
| 61 | } | ||
| 60 | 62 | ||
| 61 | info!("setting extended address"); | 63 | info!("setting extended address"); |
| 62 | let extended_address: u64 = 0xACDE480000000002; | 64 | let extended_address: u64 = 0xACDE480000000002; |
| @@ -67,8 +69,10 @@ async fn main(spawner: Spawner) { | |||
| 67 | }) | 69 | }) |
| 68 | .await | 70 | .await |
| 69 | .unwrap(); | 71 | .unwrap(); |
| 70 | let evt = mbox.mac_subsystem.read().await; | 72 | { |
| 71 | info!("{:#x}", evt); | 73 | let evt = mbox.mac_subsystem.read().await; |
| 74 | info!("{:#x}", evt.mac_event()); | ||
| 75 | } | ||
| 72 | 76 | ||
| 73 | info!("getting extended address"); | 77 | info!("getting extended address"); |
| 74 | mbox.mac_subsystem | 78 | mbox.mac_subsystem |
| @@ -78,14 +82,16 @@ async fn main(spawner: Spawner) { | |||
| 78 | }) | 82 | }) |
| 79 | .await | 83 | .await |
| 80 | .unwrap(); | 84 | .unwrap(); |
| 81 | let evt = mbox.mac_subsystem.read().await; | 85 | { |
| 82 | info!("{:#x}", evt); | 86 | let evt = mbox.mac_subsystem.read().await; |
| 87 | info!("{:#x}", evt.mac_event()); | ||
| 83 | 88 | ||
| 84 | if let Ok(MacEvent::MlmeGetCnf(evt)) = evt { | 89 | if let Ok(MacEvent::MlmeGetCnf(evt)) = evt.mac_event() { |
| 85 | if evt.pib_attribute_value_len == 8 { | 90 | if evt.pib_attribute_value_len == 8 { |
| 86 | let value = unsafe { core::ptr::read_unaligned(evt.pib_attribute_value_ptr as *const u64) }; | 91 | let value = unsafe { core::ptr::read_unaligned(evt.pib_attribute_value_ptr as *const u64) }; |
| 87 | 92 | ||
| 88 | info!("value {:#x}", value) | 93 | info!("value {:#x}", value) |
| 94 | } | ||
| 89 | } | 95 | } |
| 90 | } | 96 | } |
| 91 | 97 | ||
| @@ -104,8 +110,10 @@ async fn main(spawner: Spawner) { | |||
| 104 | }; | 110 | }; |
| 105 | info!("{}", a); | 111 | info!("{}", a); |
| 106 | mbox.mac_subsystem.send_command(&a).await.unwrap(); | 112 | mbox.mac_subsystem.send_command(&a).await.unwrap(); |
| 107 | let evt = mbox.mac_subsystem.read().await; | 113 | { |
| 108 | info!("{:#x}", evt); | 114 | let evt = mbox.mac_subsystem.read().await; |
| 115 | info!("{:#x}", evt.mac_event()); | ||
| 116 | } | ||
| 109 | 117 | ||
| 110 | info!("Test OK"); | 118 | info!("Test OK"); |
| 111 | cortex_m::asm::bkpt(); | 119 | cortex_m::asm::bkpt(); |
