set bw config to high

This commit is contained in:
Shuanglei Tao
2024-12-19 17:18:29 +08:00
parent 8465deb5b3
commit a0d052894e

20
main.c
View File

@@ -321,8 +321,8 @@ static void sys_evt_dispatch(uint32_t sys_evt)
static void ble_stack_init(void)
{
uint32_t err_code;
nrf_clock_lf_cfg_t clock_lf_cfg = {.source = NRF_CLOCK_LF_SRC_SYNTH,
nrf_clock_lf_cfg_t clock_lf_cfg = {
.source = NRF_CLOCK_LF_SRC_SYNTH,
.rc_ctiv = 0,
.rc_temp_ctiv = 0,
.xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM,
@@ -353,6 +353,21 @@ static void ble_stack_init(void)
APP_ERROR_CHECK(err_code);
}
// Set BW Config to HIGH.
static void ble_options_set(void)
{
uint32_t err_code;
ble_opt_t ble_opt;
memset(&ble_opt, 0, sizeof(ble_opt));
ble_opt.common_opt.conn_bw.role = BLE_GAP_ROLE_PERIPH;
ble_opt.common_opt.conn_bw.conn_bw.conn_bw_rx = BLE_CONN_BW_HIGH;
ble_opt.common_opt.conn_bw.conn_bw.conn_bw_tx = BLE_CONN_BW_HIGH;
err_code = sd_ble_opt_set(BLE_COMMON_OPT_CONN_BW, &ble_opt);
APP_ERROR_CHECK(err_code);
}
/**@brief Function for initializing the Advertising functionality.
*/
static void advertising_init(void)
@@ -401,6 +416,7 @@ int main(void)
timers_init();
ble_stack_init();
ble_options_set();
gap_params_init();
services_init();
advertising_init();