Skip to content

nrf/softdevice : Add function to set the BT address #17406

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Blafy
Copy link

@Blafy Blafy commented Jun 1, 2025

Summary

On NRF port, this PR implements sd_ble_gap_addr_set from the Soft Device API. You can customize the bluetooth mac address.

Testing

I have only tested it on a Xiao BLE board with SD v140.

Connected to MicroPython at /dev/ttyACM0
Use Ctrl-] or Ctrl-x to exit this shell
MicroPython v1.26.0-preview.163.gdf80ad06c on 2025-06-01; XIAO nRF52840 Sense with NRF52840
Type "help()" for more information.
>>> a = bytearray([0xa1,0xba,0xc1,0xa4,0x3c,0x23])
>>> import ble
>>> ble.address()
'c8:e6:c1:a4:3c:f3'
>>> ble.address_set(a)
>>> ble.address()
'a1:ba:c1:a4:3c:23'
>>>

Trade-offs and Alternatives

This is my first PR, and I am quite rusty with C. I am not sure if this is a clean binding, as I am not familiar with the MP_* objects and methods. Also, I have set the addr_type to BLE_GAP_ADDR_TYPE_PUBLIC.

Maybe it is better to have only a ble.address() method with 2 signatures instead (0 argument = get, otherwise set) ?

Signed-off-by: Blafy <alban.boye@protonmail.com>
@Blafy Blafy force-pushed the nrf_ble_address_set branch from df80ad0 to c06b6df Compare June 1, 2025 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy