add #if for switching softdevice

This commit is contained in:
hathach committed 2017-10-05 15:33:27 +07:00
1 parent b339718520
commit dc30b91a99
2 files changed
+12 -1

No files matched your search

@@ -299,12 +299,19 @@ bool BLEAdvertising::_start(uint16_t interval, uint16_t timeout)
.type = _type ,
.p_peer_addr = NULL , // Undirected advertisement
.fp = BLE_GAP_ADV_FP_ANY ,
#if SD_VER < 500
.p_whitelist = NULL ,
#endif
.interval = interval , // advertising interval (in units of 0.625 ms)
.timeout = timeout ,
.channel_mask = { 0, 0, 0 } , // Enable all 3 adv channels
//.channel_mask = { 0, 0, 0 } , // Enable all 3 adv channels
};
#if SD_VER < 500
VERIFY_STATUS( sd_ble_gap_adv_start(&adv_para), false );
#else
VERIFY_STATUS( sd_ble_gap_adv_start(&adv_para, BLE_CONN_CFG_TAG_DEFAULT), false );
#endif
Bluefruit._startConnLed(); // start blinking
_runnning = true;
@@ -80,7 +80,11 @@ bool BLECentral::connect(const ble_gap_addr_t* peer_addr)
.conn_sup_timeout = BLE_GAP_CONN_SUPERVISION_TIMEOUT_MS / 10 // in 10ms unit
};
#if SD_VER < 500
VERIFY_STATUS( sd_ble_gap_connect(peer_addr, Bluefruit.Scanner.getParams(), &gap_conn_params), false );
#else
VERIFY_STATUS( sd_ble_gap_connect(peer_addr, Bluefruit.Scanner.getParams(), &gap_conn_params, BLE_CONN_CFG_TAG_DEFAULT), false );
#endif
return true;
}