/**@brief Function for the SoftDevice initialization. * * @details This function initializes the SoftDevice and the BLE event interrupt. */ static void ble_stack_init(void) { uint32_t err_code; nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC; // Initialize SoftDevice. SOFTDEVICE_HANDLER_INIT(&clock_lf_cfg, NULL); ble_enable_params_t ble_enable_params; err_code = softdevice_enable_get_default_config(CENTRAL_LINK_COUNT, PERIPHERAL_LINK_COUNT, &ble_enable_params); APP_ERROR_CHECK(err_code); //Check the ram settings against the used number of links CHECK_RAM_START_ADDR(CENTRAL_LINK_COUNT,PERIPHERAL_LINK_COUNT); // Enable BLE stack. err_code = softdevice_enable(&ble_enable_params); APP_ERROR_CHECK(err_code); // Subscribe for BLE events. err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch); APP_ERROR_CHECK(err_code); }
/**@brief Function for initializing the BLE stack. * * @details Initializes the SoftDevice and the BLE event interrupt. */ static void ble_stack_init(void) { uint32_t err_code; nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC; // Initialize the SoftDevice handler module. SOFTDEVICE_HANDLER_INIT(&clock_lf_cfg, NULL); ble_enable_params_t ble_enable_params; err_code = softdevice_enable_get_default_config(NRF_BLE_CENTRAL_LINK_COUNT, NRF_BLE_PERIPHERAL_LINK_COUNT, &ble_enable_params); APP_ERROR_CHECK(err_code); // Check the ram settings against the used number of links CHECK_RAM_START_ADDR(NRF_BLE_CENTRAL_LINK_COUNT, NRF_BLE_PERIPHERAL_LINK_COUNT); // Enable BLE stack. #if (NRF_SD_BLE_API_VERSION == 3) ble_enable_params.gatt_enable_params.att_mtu = NRF_BLE_GATT_MAX_MTU_SIZE; #endif err_code = softdevice_enable(&ble_enable_params); APP_ERROR_CHECK(err_code); // Register with the SoftDevice handler module for BLE events. err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch); APP_ERROR_CHECK(err_code); // Register with the SoftDevice handler module for BLE events. err_code = softdevice_sys_evt_handler_set(sys_evt_dispatch); APP_ERROR_CHECK(err_code); }
/**@brief Function for initializing the BLE stack. * * @details Initializes the SoftDevice and the BLE event interrupt. */ static void ble_stack_init(void) { uint32_t err_code; nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC; // Initialize the SoftDevice handler module. SOFTDEVICE_HANDLER_INIT(&clock_lf_cfg, NULL); ble_enable_params_t ble_enable_params; err_code = softdevice_enable_get_default_config(CENTRAL_LINK_COUNT, PERIPHERAL_LINK_COUNT, &ble_enable_params); APP_ERROR_CHECK(err_code); #ifdef BLE_DFU_APP_SUPPORT ble_enable_params.gatts_enable_params.service_changed = 1; #endif // BLE_DFU_APP_SUPPORT //Check the ram settings against the used number of links CHECK_RAM_START_ADDR(CENTRAL_LINK_COUNT,PERIPHERAL_LINK_COUNT); // Enable BLE stack. err_code = softdevice_enable(&ble_enable_params); APP_ERROR_CHECK(err_code); // Register with the SoftDevice handler module for BLE events. err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch); APP_ERROR_CHECK(err_code); // Register with the SoftDevice handler module for BLE events. err_code = softdevice_sys_evt_handler_set(sys_evt_dispatch); APP_ERROR_CHECK(err_code); }
/**@brief Function for initializing the BLE stack. * * @details Initializes the SoftDevice and the BLE event interrupts. */ static void ble_stack_init(void) { ret_code_t err_code; nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC; // Initialize the SoftDevice handler module. SOFTDEVICE_HANDLER_INIT(&clock_lf_cfg, NULL); ble_enable_params_t ble_enable_params; err_code = softdevice_enable_get_default_config(CENTRAL_LINK_COUNT, PERIPHERAL_LINK_COUNT, &ble_enable_params); APP_ERROR_CHECK(err_code); // Stack checks first if there are still entries in the table before checking if a vendor // specific UUID is already in the table thus to be able to call sd_ble_uuid_vs_add several // times with the same entry, vs_uuid_count has to be 1 bigger than what is actually needed. ble_enable_params.common_enable_params.vs_uuid_count = 2; // Check the ram settings against the used number of links CHECK_RAM_START_ADDR(CENTRAL_LINK_COUNT,PERIPHERAL_LINK_COUNT); // Enable BLE stack. err_code = softdevice_enable(&ble_enable_params); APP_ERROR_CHECK(err_code); // Register with the SoftDevice handler module for BLE events. err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch); APP_ERROR_CHECK(err_code); }
/**@brief Function for initializing the BLE stack. * * @details Initializes the SoftDevice and the BLE event interrupt. */ static void ble_stack_init(void) { uint32_t err_code; // Initialize the SoftDevice handler module. SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, NULL); ble_enable_params_t ble_enable_params; err_code = softdevice_enable_get_default_config(CENTRAL_LINK_COUNT, PERIPHERAL_LINK_COUNT, &ble_enable_params); APP_ERROR_CHECK(err_code); //Check the ram settings against the used number of links CHECK_RAM_START_ADDR(CENTRAL_LINK_COUNT,PERIPHERAL_LINK_COUNT); // Enable BLE stack. err_code = softdevice_enable(&ble_enable_params); APP_ERROR_CHECK(err_code); // Register with the SoftDevice handler module for BLE events. err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch); APP_ERROR_CHECK(err_code); // Register with the SoftDevice handler module for BLE events. err_code = softdevice_sys_evt_handler_set(sys_evt_dispatch); APP_ERROR_CHECK(err_code); }
/**@brief Function for the SoftDevice initialization. * * @details This function initializes the SoftDevice and the BLE event interrupt. */ static void ble_stack_init(void) { uint32_t err_code; // Initialize SoftDevice. // SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, NULL); SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_RC_250_PPM_TEMP_8000MS_CALIBRATION, false); ble_enable_params_t ble_enable_params; err_code = softdevice_enable_get_default_config(CENTRAL_LINK_COUNT, PERIPHERAL_LINK_COUNT, &ble_enable_params); APP_ERROR_CHECK(err_code); //Check the ram settings against the used number of links CHECK_RAM_START_ADDR(CENTRAL_LINK_COUNT, PERIPHERAL_LINK_COUNT); extern void __data_start__; if (IDEAL_RAM_START_ADDRESS(CENTRAL_LINK_COUNT, PERIPHERAL_LINK_COUNT) != (uint32_t)&__data_start__) { jsiConsolePrintf("WARNING: BLE RAM start address not correct - is 0x%x, should be 0x%x", (uint32_t)&__data_start__, IDEAL_RAM_START_ADDRESS(CENTRAL_LINK_COUNT, PERIPHERAL_LINK_COUNT)); jshTransmitFlush(); } // Enable BLE stack. err_code = softdevice_enable(&ble_enable_params); APP_ERROR_CHECK(err_code); // Subscribe for BLE events. err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch); APP_ERROR_CHECK(err_code); }
/**@brief Function for initializing the BLE stack. * * @details Initializes the SoftDevice and the BLE event interrupt. */ void ble_stack_init(void) { uint32_t err_code; //Copied from pca10028.h to cut dependence on bsp/ #define NRF_CLOCK_LFCLKSRC {.source = NRF_CLOCK_LF_SRC_XTAL, \ .rc_ctiv = 0, \ .rc_temp_ctiv = 0, \ .xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM} nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC; // Initialize the SoftDevice handler module. SOFTDEVICE_HANDLER_INIT(&clock_lf_cfg, NULL); ble_enable_params_t ble_enable_params; err_code = softdevice_enable_get_default_config(CENTRAL_LINK_COUNT, PERIPHERAL_LINK_COUNT, &ble_enable_params); APP_ERROR_CHECK(err_code); ble_enable_params.common_enable_params.vs_uuid_count = VENDOR_SPECIFIC_UUID_COUNT; //Check the ram settings against the used number of links CHECK_RAM_START_ADDR(CENTRAL_LINK_COUNT,PERIPHERAL_LINK_COUNT); // Enable BLE stack. err_code = softdevice_enable(&ble_enable_params); APP_ERROR_CHECK(err_code); // Register with the SoftDevice handler module for BLE events. err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch); APP_ERROR_CHECK(err_code); // Register with the SoftDevice handler module for System events. err_code = softdevice_sys_evt_handler_set(sys_evt_dispatch); APP_ERROR_CHECK(err_code); }
/**@brief Function for initializing the BLE stack. * * @details Initializes the SoftDevice and the BLE event interrupt. */ static void ble_stack_init(void) { uint32_t err_code; // Initialize the SoftDevice handler module. SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, NULL); ble_enable_params_t ble_enable_params; err_code = softdevice_enable_get_default_config(CENTRAL_LINK_COUNT, PERIPHERAL_LINK_COUNT, &ble_enable_params); if (err_code == NRF_SUCCESS) debug_printf("Softdevice configured with links and ble parameters!\r\n"); else { debug_printf("Ooops.. Something is wrong with setting softdevice parameters..\r\n"); APP_ERROR_CHECK(err_code); } #ifdef BLE_DFU_APP_SUPPORT ble_enable_params.gatts_enable_params.service_changed = 1; #endif // BLE_DFU_APP_SUPPORT //Check the ram settings against the used number of links CHECK_RAM_START_ADDR(CENTRAL_LINK_COUNT,PERIPHERAL_LINK_COUNT); //memset(&ble_enable_params, 0, sizeof(ble_enable_params)); ble_enable_params.common_enable_params.vs_uuid_count = 2; //ble_enable_params.gatts_enable_params.attr_tab_size = 0x0900; //changing stack size? // Enable BLE stack. err_code = softdevice_enable(&ble_enable_params); if (err_code == NRF_SUCCESS) debug_printf("Softdevice enabled successfully!\r\n"); else { debug_printf("Ooops.. Something is wrong with enabling softdevice..\r\n"); APP_ERROR_CHECK(err_code); } // Register with the SoftDevice handler module for BLE events. err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch); if (err_code == NRF_SUCCESS) debug_printf("Softdevice registered for BLE events!\r\n"); else { debug_printf("Ooops.. Something went wrong with registering to BLE events..\r\n"); APP_ERROR_CHECK(err_code); } // Register with the SoftDevice handler module for SYS events. err_code = softdevice_sys_evt_handler_set(sys_evt_dispatch); if (err_code == NRF_SUCCESS) debug_printf("Softdevice registered for SYS events!\r\n"); else { debug_printf("Ooops.. Something went wrong with registering to SYS events..\r\n"); APP_ERROR_CHECK(err_code); } }