Recently in the porting QQ IoT protocol, you need to read the device MAC address.
Read the CC2541 device MAC address method, there is a direct read Mac register, you can also call the protocol stack API. This takes the form of a call API.
1 /*use the protocol stack API to read MAC addresses*/2 StaticUint8 macaddr[b_addr_len]={0};//MAC address3uint8_t macstr[ -] = {0};4 5 Gaprole_getparameter (gaprole_bd_addr, MACADDR); 6sprintf ((Char*) Macstr,"%02x%02x%02x%02x%02x%02x", macaddr[0], macaddr[1], macaddr[2], 7macaddr[3], macaddr[4], macaddr[5]); 8memcpy (Zone, MACSTR, A);
The core content is Api:gaprole_getparameter
This API can refer to the 102th page of CC2541 Software Developer's Guide, where you can find the definition of this function in the IAR itself, and gaprole_bd_addr is a type that represents the MAC address of the Bluetooth device.
Bluetooth uses the protocol stack API to read device MAC addresses