sdk中相关api
 获得本地mac地址 
[out] p_addr 
uint32_t sd_ble_gap_address_get(ble_gap_addr_t *p_addr);
 
ble_gap_addr_t 结构体如下
/**@brief Bluetooth Low Energy address. */
typedef struct{  
//地址类型  
uint8_t addr_type;                    /**< See @ref BLE_GAP_ADDR_TYPES. */  
//存放地址的数组 6字节  
uint8_t addr[BLE_GAP_ADDR_LEN];       /**< 48-bit address, LSB format. */
} ble_gap_addr_t;
 
[in]addr_cycle_mode : 
/**< Set addresses directly, no automatic address cycling. */ 
BLE_GAP_ADDR_CYCLE_MODE_NONE      0x00  
/**< Automatically generate and update private addresses. */ 
BLE_GAP_ADDR_CYCLE_MODE_AUTO      0x01 
注意当用他设置成静态随机地址Static Device Address时,地址的最高2bits必须为“11”,否则无效
uint32_t sd_ble_gap_address_set(uint8_t addr_cycle_mode, ble_gap_addr_t const *p_addr);
 
下面是把默认地址+1后设置的函数
void mac_set(void)
{  
  ble_gap_addr_t addr;  //获得地址  
  uint32_t  err_code = sd_ble_gap_address_get(&addr);  
  APP_ERROR_CHECK(err_code);  
  addr.addr[0] += 1;  
  //写地址  
  err_code = sd_ble_gap_address_set(BLE_GAP_ADDR_CYCLE_MODE_NONE, &addr);  
  APP_ERROR_CHECK(err_code);
}
原文链接:https://blog.csdn.net/loosen17/article/details/98184652