ESP32_RTOS_SDK V1.1.0

- Main Page
- Modules
- Data Structures
- Files

Enumerations | Functions
Hardware MAC APIs
System APIs

Hardware MAC address APIs. More...

## Enumerations

enum | mac_group { DEFAULT_MAC = 0, USER_MAC }
enum | mac_type { WIFI_MAC = 0, BT_MAC }

## Functions

int | system_efuse_program_user_mac (mac_type type, uint8 *mac)
| Set user-define hardware MAC address. More...
bool | system_efuse_read_mac (mac_group group, mac_type type, uint8 *mac)
| Read hardware MAC address. More...
bool | system_efuse_set_mac_group (mac_group group)
| Set hardware MAC group, default MAC or user-defined MAC. More...
mac_group | system_efuse_get_mac_group (void)
| Get hardware MAC group, default MAC or user-defined MAC. More...

## Detailed Description

Hardware MAC address APIs.

In WiFi MAC, only ESP32 station MAC is the hardware MAC, ESP32 softAP MAC is a software MAC calculated from ESP32 station MAC. So users need to call wifi_get_macaddr to query the ESP32 softAP MAC if ESP32 station MAC changed.

## Enumeration Type Documentation

enum mac_group

Enumerator
DEFAULT_MAC | Default hardware MAC provided by Espressif Systems
USER_MAC | User-define hardware MAC

enum mac_type

Enumerator
WIFI_MAC | Hardware MAC address of ESP32 WiFi
BT_MAC | Hardware MAC address of ESP32 bluetooth

## Function Documentation

mac_group system_efuse_get_mac_group | ( | void |  | ) |

Get hardware MAC group, default MAC or user-defined MAC.

Parameters

  null |

Returns
  mac_group, the hardware MAC group.

int system_efuse_program_user_mac | ( | mac_type | type,
|  | uint8 * | mac
| ) |  |

Set user-define hardware MAC address.

Attention
  Hardware MAC address can only be set ONCE for each ESP32 chip.

Parameters

  mac_type | type : type of hardware MAC address.
  uint8 | *mac : user-define hardware MAC address, length: 6 bytes.

Returns
  0 : succeed to set.
  1 : the hardware MAC has been set once, users can not set it any more.
  2 : fail to set.
  3 : invalid parameter.

bool system_efuse_read_mac | ( | mac_group | group,
|  | mac_type | type,
|  | uint8 * | mac
| ) |  |

Read hardware MAC address.

Parameters

  mac_group | group : default MAC or user-defined MAC.
  mac_type | type : type of hardware MAC address.
  uint8 | *mac : the hardware MAC address, length: 6 bytes.

Returns
  true : succeed
  false : fail

bool system_efuse_set_mac_group | ( | mac_group | group | ) |

Set hardware MAC group, default MAC or user-defined MAC.

Attention
  This API needs system_restart to take effect.

Parameters

  mac_group | group : default MAC or user-defined MAC.

Returns
  true : succeed
  false : fail