This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Formatting MAC address ble_gap_addr_t.addr

I'm using this code to log the BLE MAC address on my peripheral device, an nRF51822.

void ble_log_mac_address(void)
{
	// Log our BLE address (6 bytes).
	ble_gap_addr_t addr;
	uint32_t err_code = sd_ble_gap_address_get(&addr);
	APP_ERROR_CHECK(err_code);

	NRF_LOG_RAW_INFO("\n%s\n", (int)addr.addr);
}

The output looks like this:

≴?A?b`

How do I get this into a more familiar format, such as this (and what is this format called, btw)?

D8:02:5C:D0:AC:77

Can I do this purely with a format string for NRF_LOG_RAW_INFO()?

Parents Reply Children
No Data
Related