nrf5/bluetooth: Updating connect function in the bluetooth driver to do a successful connect to a peripheral device.
This commit is contained in:
parent
4d147beedb
commit
bcf4631e0a
@ -704,7 +704,7 @@ void ble_drv_connect(uint8_t * p_addr, uint8_t addr_type) {
|
|||||||
scan_params.active = 1;
|
scan_params.active = 1;
|
||||||
scan_params.interval = MSEC_TO_UNITS(100, UNIT_0_625_MS);
|
scan_params.interval = MSEC_TO_UNITS(100, UNIT_0_625_MS);
|
||||||
scan_params.window = MSEC_TO_UNITS(100, UNIT_0_625_MS);
|
scan_params.window = MSEC_TO_UNITS(100, UNIT_0_625_MS);
|
||||||
scan_params.timeout = 0; // Infinite
|
scan_params.timeout = 0; // infinite
|
||||||
|
|
||||||
#if (BLUETOOTH_SD == 130)
|
#if (BLUETOOTH_SD == 130)
|
||||||
scan_params.selective = 0;
|
scan_params.selective = 0;
|
||||||
@ -719,8 +719,20 @@ void ble_drv_connect(uint8_t * p_addr, uint8_t addr_type) {
|
|||||||
addr.addr_type = addr_type;
|
addr.addr_type = addr_type;
|
||||||
memcpy(addr.addr, p_addr, 6);
|
memcpy(addr.addr, p_addr, 6);
|
||||||
|
|
||||||
|
BLE_DRIVER_LOG("GAP CONNECTING: "HEX2_FMT":"HEX2_FMT":"HEX2_FMT":"HEX2_FMT":"HEX2_FMT":"HEX2_FMT", type: %d\n",
|
||||||
|
addr.addr[0], addr.addr[1], addr.addr[2], addr.addr[3], addr.addr[4], addr.addr[5], addr.addr_type);
|
||||||
|
|
||||||
ble_gap_conn_params_t conn_params;
|
ble_gap_conn_params_t conn_params;
|
||||||
(void)sd_ble_gap_ppcp_get(&conn_params);
|
|
||||||
|
// (void)sd_ble_gap_ppcp_get(&conn_params);
|
||||||
|
|
||||||
|
// set connection parameters
|
||||||
|
memset(&conn_params, 0, sizeof(conn_params));
|
||||||
|
|
||||||
|
conn_params.min_conn_interval = BLE_MIN_CONN_INTERVAL;
|
||||||
|
conn_params.max_conn_interval = BLE_MAX_CONN_INTERVAL;
|
||||||
|
conn_params.slave_latency = BLE_SLAVE_LATENCY;
|
||||||
|
conn_params.conn_sup_timeout = BLE_CONN_SUP_TIMEOUT;
|
||||||
|
|
||||||
uint32_t err_code;
|
uint32_t err_code;
|
||||||
if ((err_code = sd_ble_gap_connect(&addr, &scan_params, &conn_params)) != 0) {
|
if ((err_code = sd_ble_gap_connect(&addr, &scan_params, &conn_params)) != 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user