wpan/mac: use lifetimes to control events

This commit is contained in:
xoviat 2023-07-16 15:09:30 -05:00
parent 7c465465c1
commit 28b419d65e
7 changed files with 243 additions and 608 deletions
tests/stm32/src/bin

View file

@ -55,8 +55,10 @@ async fn main(spawner: Spawner) {
})
.await
.unwrap();
let evt = mbox.mac_subsystem.read().await;
info!("{:#x}", evt);
{
let evt = mbox.mac_subsystem.read().await;
info!("{:#x}", evt.mac_event());
}
info!("setting extended address");
let extended_address: u64 = 0xACDE480000000002;
@ -67,8 +69,10 @@ async fn main(spawner: Spawner) {
})
.await
.unwrap();
let evt = mbox.mac_subsystem.read().await;
info!("{:#x}", evt);
{
let evt = mbox.mac_subsystem.read().await;
info!("{:#x}", evt.mac_event());
}
info!("getting extended address");
mbox.mac_subsystem
@ -78,14 +82,16 @@ async fn main(spawner: Spawner) {
})
.await
.unwrap();
let evt = mbox.mac_subsystem.read().await;
info!("{:#x}", evt);
{
let evt = mbox.mac_subsystem.read().await;
info!("{:#x}", evt.mac_event());
if let Ok(MacEvent::MlmeGetCnf(evt)) = evt {
if evt.pib_attribute_value_len == 8 {
let value = unsafe { core::ptr::read_unaligned(evt.pib_attribute_value_ptr as *const u64) };
if let Ok(MacEvent::MlmeGetCnf(evt)) = evt.mac_event() {
if evt.pib_attribute_value_len == 8 {
let value = unsafe { core::ptr::read_unaligned(evt.pib_attribute_value_ptr as *const u64) };
info!("value {:#x}", value)
info!("value {:#x}", value)
}
}
}
@ -104,8 +110,10 @@ async fn main(spawner: Spawner) {
};
info!("{}", a);
mbox.mac_subsystem.send_command(&a).await.unwrap();
let evt = mbox.mac_subsystem.read().await;
info!("{:#x}", evt);
{
let evt = mbox.mac_subsystem.read().await;
info!("{:#x}", evt.mac_event());
}
info!("Test OK");
cortex_m::asm::bkpt();