1、在結構體 ble_nus_s 添加 ble_gatts_char_handles_t rx_handles1; ble_gatts_char_handles_t rx_handles2;
2、模仿 rx_char_add 函式添加 rx_char_add1 rx_char_add2 2個函式,新增函式中需要修改 UUID BLE_UUID_NUS_RX_CHARACTERISTIC及rx_handles1值
3、模仿 ble_nus_string_send 函式添加 ble_nus_string_send1 ble_nus_string_send2 2個資料發送函式,新增函式中需要修改 rx_handles1 值
4、on_write 修改如下:
/*
if (
(p_evt_write->handle == p_nus->rx_handles.cccd_handle)
&&
(p_evt_write->len == 2)
)
*/
if (
((p_evt_write->handle == p_nus->rx_handles.cccd_handle) ||
(p_evt_write->handle == p_nus->rx_handles1.cccd_handle) ||
(p_evt_write->handle == p_nus->rx_handles2.cccd_handle))
&&
(p_evt_write->len == 2)
)
5、在 ble_nus_init 函式中添加 以下代碼:
err_code = rx_char_add_1(p_nus, p_nus_init);
VERIFY_SUCCESS(err_code);
err_code = rx_char_add_2(p_nus, p_nus_init);
VERIFY_SUCCESS(err_code);
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/112856.html
標籤:單片機/工控
下一篇:請教有關靜電設計
