mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-21 14:22:33 +00:00
Added MAC address getter to cyw43 controller
This commit is contained in:
parent
20110ce6c7
commit
6ffecb1250
@ -124,8 +124,7 @@ impl<'a> Control<'a> {
|
||||
self.set_iovar_u32("apsta", 1).await;
|
||||
|
||||
// read MAC addr.
|
||||
let mut mac_addr = [0; 6];
|
||||
assert_eq!(self.get_iovar("cur_etheraddr", &mut mac_addr).await, 6);
|
||||
let mac_addr = self.address().await;
|
||||
debug!("mac addr: {:02x}", Bytes(&mac_addr));
|
||||
|
||||
let country = countries::WORLD_WIDE_XX;
|
||||
@ -574,6 +573,13 @@ impl<'a> Control<'a> {
|
||||
self.ioctl(IoctlType::Set, IOCTL_CMD_DISASSOC, 0, &mut []).await;
|
||||
info!("Disassociated")
|
||||
}
|
||||
|
||||
/// Gets the MAC address of the device
|
||||
pub async fn address(&mut self) -> [u8; 6] {
|
||||
let mut mac_addr = [0; 6];
|
||||
assert_eq!(self.get_iovar("cur_etheraddr", &mut mac_addr).await, 6);
|
||||
mac_addr
|
||||
}
|
||||
}
|
||||
|
||||
/// WiFi network scanner.
|
||||
|
Loading…
Reference in New Issue
Block a user