nrf51822 修改藍芽名字

2021-07-10 10:01:52 字數 1420 閱讀 4215

1.目的

修改藍芽的名字

2.分析

藍芽名字最長設定為20個位元組,超過20個位元組為無效

3.平台:

協議棧版本:sdk10.0.0

編譯軟體:keil 5.14

硬體平台:nrf51822最小系統

4.步驟

首先,要知道設定名字的api :

在ble_gap.h

/**@brief set gap device name.

** @param[in] p_write_perm write permissions for the device name characteristic, see @ref ble_gap_conn_sec_mode_t.

* @param[in] p_dev_name pointer to a utf-8 encoded,non null-terminatedstring.

* @param[in] len length of the utf-8,non null-terminatedstring pointed to by p_dev_name in octets (must be smaller or equal than @ref ble_gap_devname_max_len).

** @retval ::nrf_success gap device name and permissions set successfully.

* @retval ::nrf_error_invalid_addr invalid pointer supplied.

* @retval ::nrf_error_invalid_param invalid parameter(s) supplied.

* @retval ::nrf_error_data_size invalid data size(s) supplied.

*/svcall(sd_ble_gap_device_name_set, uint32_t, sd_ble_gap_device_name_set(ble_gap_conn_sec_mode_t const *p_write_perm, uint8_t const *p_dev_name, uint16_t len));

static void setdevicename(unsigned char *name ,unsigned char size)

;ble_gap_conn_sec_mode_t sec_mode;

ble_gap_conn_sec_mode_set_open(&sec_mode);

err_code = sd_ble_gap_device_name_set(&sec_mode,

(const uint8_t *)name,

size);

sd_ble_gap_device_name_set()返回 nrf_success  表示成功。

藍芽nrf51822使用s110 nrf51

問題描述 在例程中第一次燒錄不會出錯,當修改了源程式再次燒錄時會出現 programming failed error flash download failed cortex m0 的錯誤。在debug和utilities配置中都沒有錯,編譯也沒有出錯。解決方法 在target裡面修改,當再次燒錄...

nrf51822如何修改mac位址

裝置跟手機配對後手機會儲存當前配對的一些profile,例如hid的描述符,例如我裝置有兩種模式 舉個不恰當的例子 滑鼠和鍵盤,按住按鍵1開機是ble鍵盤,按住按鍵2開機是ble滑鼠,這時候就需要有不同mac位址的需求,否則會出現現在當前是鍵盤跟手機或者電腦配對,然後手機儲存了當前的配對內容把你當成...

nrf51822 廣播間隔

1.目的 設定廣播間隔,已達到乙個功耗最佳的狀態 2.分析 廣播間隔,指每次藍芽廣播之間的間隔,間隔越大功耗越低,間隔越小功耗越大 3.平台 協議棧版本 sdk10.0.0 編譯軟體 keil 5.14 硬體平台 nrf51822最小系統 4.步驟 在main.c static void adver...