Skip to main content

interface_mac_address

Function interface_mac_address 

Source
pub fn interface_mac_address(kind: InterfaceMacAddress) -> MacAddress
Expand description

Returns the MAC address for a specific interface, derived from the base MAC.

By default, addresses are derived from the factory eFuse MAC returned by base_mac_address. If override_mac_address has been called, the overridden base address is used instead.

Each chip is programmed with a unique base MAC address during manufacturing. Different interfaces (Wi-Fi Station, SoftAP, Bluetooth, etc.) each use a MAC address derived from this base address. The Station interface uses the base MAC directly, while others use locally administered variants produced by modifying the first octet to set the local-admin bit; some interfaces (such as Bluetooth) additionally adjust the last octet to obtain a distinct address.

ยงExample

use esp_hal::efuse::{self, InterfaceMacAddress};

let mac = efuse::interface_mac_address(InterfaceMacAddress::Station);
println!("MAC: {mac}");