void test_app_init(void) { nrf_gpio_cfg_output(LED_0); nrf_gpio_cfg_output(LED_1); #ifdef BOARD_PCA10000 nrf_gpio_pin_clear(LED_RGB_RED); nrf_gpio_pin_clear(LED_RGB_GREEN); nrf_gpio_pin_clear(LED_RGB_BLUE); #endif #ifdef BOARD_PCA10031 nrf_gpio_pin_clear(LED_RGB_RED); nrf_gpio_pin_clear(LED_RGB_GREEN); nrf_gpio_pin_clear(LED_RGB_BLUE); #endif #ifdef BOARD_PCA10001 nrf_gpio_range_cfg_output(0, 32); nrf_gpio_cfg_input(BUTTON_0, BUTTON_PULL); nrf_gpio_cfg_input(BUTTON_1, BUTTON_PULL); gpiote_init(); #endif #ifdef BOARD_PCA10031 nrf_gpio_range_cfg_output(0, 32); nrf_gpio_cfg_input(BUTTON_0, BUTTON_PULL); nrf_gpio_cfg_input(BUTTON_1, BUTTON_PULL); gpiote_init(); #endif led_config(1, 0); led_config(2, 0); }
/**@brief Function for the application main entry. */ int main(void) { uint32_t err_code; timers_init(); gpiote_init(); buttons_init(); nrf_gpio_cfg_output(CONNECTED_LED_PIN_NO); //DM: Green LED controlled directly. Red through GPIOTE task (Timer1_Compare[0]) ble_stack_init(); bond_manager_init(); // Initialize Bluetooth Stack parameters gap_params_init(); advertising_init(); services_init(); conn_params_init(); //just for relayr, iBeacon does´t allow connect sec_params_init(); //iBeacon: no security // Start advertising advertising_start(); // Enter main loop for (;;) { // Switch to a low power state until an event is available for the application err_code = sd_app_evt_wait(); APP_ERROR_CHECK(err_code); } }
/** @brief Function for main application entry. */ int main(void) { gpiote_init(); ppi_init(); timer2_init(); // Enable interrupt on Timer NVIC_EnableIRQ(TIMER2_IRQn); __enable_irq(); // Enabling constant latency as indicated by PAN 11 "HFCLK: Base current with HFCLK // running is too high" found at Product Anomaly document found at // https://www.nordicsemi.com/eng/Products/Bluetooth-R-low-energy/nRF51822/#Downloads // // @note This example does not go to low power mode therefore constant latency is not needed. // However this setting will ensure correct behaviour when routing TIMER events through // PPI (shown in this example) and low power mode simultaneously. NRF_POWER->TASKS_CONSTLAT = 1; // Start the timer. NRF_TIMER2->TASKS_START = 1; while (true) { // Do nothing. } }
/** * @brief Function for application main entry. */ int main(void) { gpiote_init(); bsp_configuration(); ppi_init(); timer2_init(); // Enabling constant latency as indicated by PAN 11 "HFCLK: Base current with HFCLK // running is too high" found at Product Anomaly document found at // https://www.nordicsemi.com/eng/Products/Bluetooth-R-low-energy/nRF51822/#Downloads // // @note This example does not go to low power mode therefore constant latency is not needed. // However this setting will ensure correct behaviour when routing TIMER events through // PPI (shown in this example) and low power mode simultaneously. NRF_POWER->TASKS_CONSTLAT = 1; // Enable interrupt on Timer 2. NVIC_EnableIRQ(TIMER2_IRQn); __enable_irq(); // Workaround for PAN-73: Use of an EVENT from any TIMER module to trigger a TASK in GPIOTE or // RTC using the PPI could fail under certain conditions. *(uint32_t *)0x4000AC0C = 1; // Start the timer. NRF_TIMER2->TASKS_START = 1; while (true) { // Do nothing. } }
/**@brief Function for application main entry. */ int main(void) { // Initialize. app_trace_init(); leds_init(); timers_init(); gpiote_init(); buttons_init(); ble_stack_init(); device_manager_init(); gap_params_init(); advertising_init(); services_init(); sensor_sim_init(); conn_params_init(); // Start execution. application_timers_start(); advertising_start(); // Enter main loop. for (;;) { power_manage(); } }
/** * @brief Function for application main entry. */ int main(void) { uint32_t err_code; // Initialize. app_trace_init(); leds_init(); timers_init(); gpiote_init(); err_code = ipv6_transport_init(); APP_ERROR_CHECK(err_code); // Initialize IP Stack. ip_stack_init(); APPL_LOG("\r\n"); APPL_LOG("[APPL]: Init complete.\r\n"); // Start execution. advertising_start(); // Enter main loop. for (;;) { /* Sleep waiting for an application event. */ err_code = sd_app_evt_wait(); APP_ERROR_CHECK(err_code); } }
/**@brief Application main function. */ int main(void) { // Initialize leds_init(); timers_init(); gpiote_init(); buttons_init(); bond_manager_init(); ble_stack_init(); scheduler_init(); gap_params_init(); advertising_init(BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE); services_init(); sensor_sim_init(); conn_params_init(); sec_params_init(); radio_notification_init(); // Start execution timers_start(); advertising_start(); // Enter main loop for (;;) { app_sched_execute(); power_manage(); } }
/**@brief Function for application main entry. */ int main(void) { uint32_t err_code; // Initialize. app_trace_init(); timers_init(); gpiote_init(); err_code = bsp_init(BSP_INIT_LED | BSP_INIT_BUTTONS, APP_TIMER_TICKS(100, APP_TIMER_PRESCALER), button_event_handler); APP_ERROR_CHECK(err_code); ble_stack_init(); adc_configure(); device_manager_init(); gap_params_init(); advertising_init(BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE); services_init(); conn_params_init(); // Start execution. advertising_start(); // Enter main loop. for (;;) { power_manage(); } }
/**@brief Application main function. */ int main(void) { // Initialize leds_init(); timers_init(); gpiote_init(); buttons_init(); ble_stack_init(); bond_manager_init(); gap_params_init(); advertising_init(); services_init(); sensor_sim_init(); conn_params_init(); sec_params_init(); radio_notification_init(); // Start execution application_timers_start(); advertising_start(); // Enter main loop for (;;) { power_manage(); } }
/**@brief Function for application main entry. */ int main(void) { // Initialize timers_init(); gpiote_init(); ble_stack_init(); bsp_module_init(); scheduler_init(); gap_params_init(); advertising_init(); services_init(); conn_params_init(); sec_params_init(); // Start execution timers_start(); advertising_start(); // Enter main loop for (;;) { app_sched_execute(); power_manage(); } }
/**@brief Function for the application main entry. */ int main(void) { uint32_t err_code; timers_init(); gpiote_init(); buttons_init(); ble_stack_init(); device_manager_init(); // Initialize Bluetooth Stack parameters. gap_params_init(); services_init(); advertising_init(); conn_params_init(); // Start advertising. advertising_start(); // Enter main loop. for (;;) { // Switch to a low power state until an event is available for the application err_code = sd_app_evt_wait(); APP_ERROR_CHECK(err_code); } }
*/ int main(void) { // Initialize. leds_init(); timers_init(); gpiote_init(); buttons_init(); ble_stack_init(); bond_manager_init(); gap_params_init(); advertising_init(BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE); services_init(); sensor_sim_init(); conn_params_init(); sec_params_init(); // Start execution. advertising_start(); // Enter main loop. for (;;) { power_manage(); }
/**@brief Function for application main entry. */ int main(void) { // Initialize leds_init(); timers_init(); gpiote_init(); buttons_init(); simple_uart_config(UART_RTS, UART_TX, UART_CTS, UART_RX, 0); ble_stack_init(); scheduler_init(); gap_params_init(); services_init(); advertising_init(); conn_params_init(); sec_params_init(); // Start execution //app_button_enable(); advertising_start(); uart_tx_str("nRF51822 run"); // Enter main loop for (;;) { app_sched_execute(); power_manage(); } }
/**@brief Function for application main entry. */ int main(void) { gpio_config(); bool success = nrf6350_lcd_init(); APP_ERROR_CHECK_BOOL(success); success = nrf6350_lcd_write_string(" BLE ANCS ", MAX_CHARACTERS_PER_LINE, LCD_UPPER_LINE, 0); APP_ERROR_CHECK_BOOL(success); // Initialize. leds_init(); timers_init(); gpiote_init(); buttons_init(); ble_stack_init(); bond_manager_init(); gap_params_init(); service_add(); advertising_init(); conn_params_init(); sec_params_init(); radio_notification_init(); // Start execution. advertising_start(); // Enter main loop. for (;;) { power_manage(); } }
void led_start(void) { ppi_init(); timer1_init(); gpiote_init(); NRF_TIMER1->TASKS_START = 1; }
/**@brief Function for bootloader main entry. */ int main(void) { uint32_t err_code; bool dfu_start = false; bool app_reset = (NRF_POWER->GPREGRET == BOOTLOADER_DFU_START); // This check ensures that the defined fields in the bootloader corresponds with actual // setting in the nRF51 chip. APP_ERROR_CHECK_BOOL(*((uint32_t *)NRF_UICR_BOOT_START_ADDRESS) == BOOTLOADER_REGION_START); APP_ERROR_CHECK_BOOL(NRF_FICR->CODEPAGESIZE == CODE_PAGE_SIZE); // Initialize. timers_init(); gpiote_init(); buttons_init(); bootloader_init(); // Check if we reset in the middle of a firmware update if (bootloader_dfu_sd_in_progress()) { err_code = bootloader_dfu_sd_update_continue(); APP_ERROR_CHECK(err_code); softdevice_init(!app_reset); scheduler_init(); err_code = bootloader_dfu_sd_update_finalize(); APP_ERROR_CHECK(err_code); } else { // If stack is present then continue initialization of bootloader. softdevice_init(!app_reset); scheduler_init(); } // Check if the Bootloader Control pin is low. If so, enter the bootloader // mode. dfu_start = (nrf_gpio_pin_read(BOOTLOADER_CTRL_PIN) == 0); // If the Bootloader Control pin is low or the application in the flash // is not valid, enter the bootloader mode. if (dfu_start || (!bootloader_app_is_valid(DFU_BANK_0_REGION_START))) { err_code = sd_power_gpregret_clr(POWER_GPREGRET_GPREGRET_Msk); APP_ERROR_CHECK(err_code); // Initiate an update of the firmware. err_code = bootloader_dfu_start(); APP_ERROR_CHECK(err_code); } // If the application was or now is valid, run it if (bootloader_app_is_valid(DFU_BANK_0_REGION_START)) { // Select a bank region to use as application region. // @note: Only applications running from DFU_BANK_0_REGION_START is supported. bootloader_app_start(DFU_BANK_0_REGION_START); } NVIC_SystemReset(); }
/**@brief Function for starting flashing the LED. * @details This will start the TIMER1 and enable the GPIOTE task that toggles the LED. * The PPI and GPIOTE configurations done by this app will make this action result in the * flashing of the LED. * @pre Can only be called after the SoftDevice is enabled - uses nrf_soc API */ void led_start(void) { nrf_gpio_cfg_output(ADVERTISING_LED); ppi_init(); timer1_init(); gpiote_init(); NRF_TIMER1->TASKS_START = 1; }
void serial_handler_init(void) { has_pending_tx = false; /* init packet queues */ tx_fifo.array_len = SERIAL_QUEUE_SIZE; tx_fifo.elem_array = tx_fifo_buffer; tx_fifo.elem_size = sizeof(serial_data_t); tx_fifo.memcpy_fptr = NULL; fifo_init(&tx_fifo); rx_fifo.array_len = SERIAL_QUEUE_SIZE; rx_fifo.elem_array = rx_fifo_buffer; rx_fifo.elem_size = sizeof(serial_data_t); rx_fifo.memcpy_fptr = NULL; fifo_init(&rx_fifo); nrf_gpio_cfg_output(PIN_RDYN); nrf_gpio_pin_set(PIN_RDYN); serial_state = SERIAL_STATE_IDLE; spi_slave_config_t spi_config; spi_config.bit_order = SPIM_LSB_FIRST; spi_config.mode = SPI_MODE_0; spi_config.def_tx_character = 0; spi_config.orc_tx_character = 0; spi_config.pin_csn = PIN_CSN; spi_config.pin_miso = PIN_MISO; spi_config.pin_mosi = PIN_MOSI; spi_config.pin_sck = PIN_SCK; APP_ERROR_CHECK(spi_slave_init(&spi_config)); APP_ERROR_CHECK(spi_slave_evt_handler_register(spi_event_handler)); gpiote_init(); /* set initial buffers, dummy in tx */ //prepare_rx(); #if 1 /* notify application controller of the restart */ serial_evt_t started_event; started_event.length = 4; started_event.opcode = SERIAL_EVT_OPCODE_DEVICE_STARTED; started_event.params.device_started.operating_mode = OPERATING_MODE_STANDBY; uint32_t reset_reason; sd_power_reset_reason_get(&reset_reason); started_event.params.device_started.hw_error = !!(reset_reason & (1 << 3)); started_event.params.device_started.data_credit_available = SERIAL_QUEUE_SIZE; if (!serial_handler_event_send(&started_event)) { APP_ERROR_CHECK(NRF_ERROR_INTERNAL); } #endif }
/**@brief Application main function. */ int main(void) { static uint8_t data_array[BLE_NUS_MAX_DATA_LEN]; static uint8_t index = 0; uint8_t newbyte; // Initialize leds_init(); timers_init(); gpiote_init(); buttons_init(); uart_init(); ble_stack_init(); gap_params_init(); services_init(); advertising_init(); conn_params_init(); sec_params_init(); uart_putstring(START_STRING); advertising_start(); // Enter main loop for (;;) { /*Stop reading new data if there are no ble buffers available */ if(ble_buffer_available) { if(app_uart_get(&newbyte) == NRF_SUCCESS) { data_array[index++] = newbyte; if (index >= (BLE_NUS_MAX_DATA_LEN)) { ble_buffer_available=ble_attempt_to_send(&data_array[0],index); if(ble_buffer_available) index=0; } } } /* Re-transmission if ble_buffer_available was set to false*/ if(tx_complete) { tx_complete=false; ble_buffer_available=ble_attempt_to_send(&data_array[0],index); if(ble_buffer_available) index =0; } power_manage(); } }
/** * @brief Function for application main entry. */ int main(void) { gpiote_init(); // Configure a GPIO to toggle on a GPIOTE task. timer0_init(); // Use TIMER0 to generate events every 200 ms. ppi_init(); // Use a PPI channel to connect the event to the task automatically. NRF_TIMER0->TASKS_START = 1; // Start event generation. while (true) { // Do Nothing - GPIO can be toggled without software intervention. } }
/**@brief Function for application main entry. */ int main(void) { uint32_t err_code; bool bootloader_is_pushed = false; leds_init(); // This check ensures that the defined fields in the bootloader corresponds with actual // setting in the nRF51 chip. APP_ERROR_CHECK_BOOL(NRF_UICR->CLENR0 == CODE_REGION_1_START); APP_ERROR_CHECK_BOOL(*((uint32_t *)NRF_UICR_BOOT_START_ADDRESS) == BOOTLOADER_REGION_START); APP_ERROR_CHECK_BOOL(NRF_FICR->CODEPAGESIZE == CODE_PAGE_SIZE); // Initialize. timers_init(); gpiote_init(); buttons_init(); ble_stack_init(); scheduler_init(); bootloader_is_pushed = ((nrf_gpio_pin_read(BOOTLOADER_BUTTON_PIN) == 0)? true: false); if (bootloader_is_pushed || (!bootloader_app_is_valid(DFU_BANK_0_REGION_START))) { nrf_gpio_pin_set(LED_2); // Initiate an update of the firmware. err_code = bootloader_dfu_start(); APP_ERROR_CHECK(err_code); nrf_gpio_pin_clear(LED_2); } if (bootloader_app_is_valid(DFU_BANK_0_REGION_START)) { leds_off(); // Select a bank region to use as application region. // @note: Only applications running from DFU_BANK_0_REGION_START is supported. bootloader_app_start(DFU_BANK_0_REGION_START); } nrf_gpio_pin_clear(LED_0); nrf_gpio_pin_clear(LED_1); nrf_gpio_pin_clear(LED_2); nrf_gpio_pin_clear(LED_7); NVIC_SystemReset(); }
/** * @brief Function for application main entry. */ int main(void) { gpiote_init(); ppi_init(); timer1_init(); NVIC_EnableIRQ(GPIOTE_IRQn); __enable_irq(); while (true) { // Do nothing. } }
/** * main function * \return 0. int return type required by ANSI/ISO standard. */ int main(void) { int i; gpio_init(); gpiote_init(); wdt_init(); //Write the value of RESETREAS to pins 9-15 (LEDs 1-7) nrf_gpio_pin_write(LED_1, NRF_POWER->RESETREAS & POWER_RESETREAS_RESETPIN_Msk); //Bit A in RESETREAS nrf_gpio_pin_write(LED_2, NRF_POWER->RESETREAS & POWER_RESETREAS_DOG_Msk); //Bit B in RESETREAS nrf_gpio_pin_write(LED_3, NRF_POWER->RESETREAS & POWER_RESETREAS_SREQ_Msk); //Bit C in RESETREAS nrf_gpio_pin_write(LED_4, NRF_POWER->RESETREAS & POWER_RESETREAS_LOCKUP_Msk); //Bit D in RESETREAS nrf_gpio_pin_write(LED_5, NRF_POWER->RESETREAS & POWER_RESETREAS_OFF_Msk); //Bit E in RESETREAS nrf_gpio_pin_write(LED_6, NRF_POWER->RESETREAS & POWER_RESETREAS_LPCOMP_Msk); //Bit F in RESETREAS nrf_gpio_pin_write(LED_7, NRF_POWER->RESETREAS & POWER_RESETREAS_DIF_Msk); //Bit G in RESETREAS NRF_POWER->RESETREAS = 0xFFFFFFFF; //Clear the RESETREAS register for(i=0;i<STARTUP_TOGGLE_ITERATIONS;i++) { nrf_gpio_pin_toggle(LED_0); nrf_delay_us(DELAY); } while (true) { //Blink LED 0 fast until watchdog triggers reset nrf_gpio_pin_toggle(LED_0); nrf_delay_us(DELAY/3); // If SYSTEM_OFF_BUTTON is pressed.. enter System Off mode if(nrf_gpio_pin_read(SYSTEM_OFF_BUTTON) == BTN_PRESSED) { // Clear PORT 1 (pins 8-15) nrf_gpio_port_clear(NRF_GPIO_PORT_SELECT_PORT1, 0xFF); // Enter system OFF. After wakeup the chip will be reset, and the program will run from the top NRF_POWER->SYSTEMOFF = 1; } // If SOFTWARE_RESET_BUTTON is pressed.. soft-reset if(nrf_gpio_pin_read(SOFTWARE_RESET_BUTTON) == BTN_PRESSED) { NVIC_SystemReset(); } } }
/**@brief Function for application main entry. */ int main(void) { uint32_t err_code; bool bootloader_is_pushed = false; static uint32_t TestAdr; TestAdr = (uint32_t)*(&(BluetoothDFU)); if(TestAdr == 100) { bootloader_is_pushed = true; F_flash_page_erase(&BluetoothDFU); ble_flash_word_write(&BluetoothDFU , 0); } // This check ensures that the defined fields in the bootloader corresponds with actual // setting in the nRF51 chip. APP_ERROR_CHECK_BOOL(NRF_UICR->CLENR0 == CODE_REGION_1_START); APP_ERROR_CHECK_BOOL(*((uint32_t *)NRF_UICR_BOOT_START_ADDRESS) == BOOTLOADER_REGION_START); APP_ERROR_CHECK_BOOL(NRF_FICR->CODEPAGESIZE == CODE_PAGE_SIZE); // Initialize. timers_init(); gpiote_init(); buttons_init(); ble_stack_init(); scheduler_init(); //bootloader_is_pushed = ((nrf_gpio_pin_read(BOOTLOADER_BUTTON_PIN) == 0)? true: false); if (bootloader_is_pushed || (!bootloader_app_is_valid(DFU_BANK_0_REGION_START))) { // Initiate an update of the firmware. err_code = bootloader_dfu_start(); APP_ERROR_CHECK(err_code); } if (bootloader_app_is_valid(DFU_BANK_0_REGION_START)) { // Select a bank region to use as application region. // @note: Only applications running from DFU_BANK_0_REGION_START is supported. bootloader_app_start(DFU_BANK_0_REGION_START); } NVIC_SystemReset(); }
int main(void) { /* Intitialization */ gpiote_init(); ppi_init(); timer2_init(); /* Enable interrupt on Timer 2*/ NVIC_EnableIRQ(TIMER2_IRQn); __enable_irq(); /* Start clock */ NRF_TIMER2->TASKS_START = 1; while (true) { } }
void pwmout_init(pwmout_t* obj, PinName pin) { // determine the channel uint8_t pwmOutSuccess = 0; PWMName pwm = (PWMName)pinmap_peripheral(pin, PinMap_PWM); MBED_ASSERT(pwm != (PWMName)NC); if(PWM_taken[(uint8_t)pwm]){ for(uint8_t i = 1; !pwmOutSuccess && (i<NO_PWMS) ;i++){ if(!PWM_taken[i]){ pwm = (PWMName)i; PWM_taken[i] = 1; pwmOutSuccess = 1; } } } else{ pwmOutSuccess = 1; PWM_taken[(uint8_t)pwm] = 1; } if(!pwmOutSuccess){ error("PwmOut pin mapping failed. All available PWM channels are in use."); } obj->pwm = pwm; obj->pin = pin; gpiote_init(pin,(uint8_t)pwm); ppi_init((uint8_t)pwm); if(pwm == 0){ NRF_POWER->TASKS_CONSTLAT = 1; } timer_init((uint8_t)pwm); //default to 20ms: standard for servos, and fine for e.g. brightness control pwmout_period_ms(obj, 20); pwmout_write (obj, 0); }
/**@brief Function for application main entry. */ int main(void) { // Initialize app_trace_init(); simple_uart_putstring((const uint8_t*) "trace init\r\n"); leds_init(); simple_uart_putstring((const uint8_t*) "leds init\r\n"); timers_init(); simple_uart_putstring((const uint8_t*) "timers init\r\n"); gpiote_init(); simple_uart_putstring((const uint8_t*) "gpiote init\r\n"); buttons_init(); simple_uart_putstring((const uint8_t*) "buttons init\r\n"); ble_stack_init(); simple_uart_putstring((const uint8_t*) "stack init\r\n"); scheduler_init(); simple_uart_putstring((const uint8_t*) "schedler init\r\n"); gap_params_init(); simple_uart_putstring((const uint8_t*) "gap init\r\n"); advertising_init(); simple_uart_putstring((const uint8_t*) "adv init\r\n"); services_init(); simple_uart_putstring((const uint8_t*) "services init\r\n"); conn_params_init(); simple_uart_putstring((const uint8_t*) "conn init\r\n"); sec_params_init(); simple_uart_putstring((const uint8_t*) "sec init\r\n"); ext_sensors_init(); simple_uart_putstring((const uint8_t*) "ext init\r\n"); // lfclk_config(); // simple_uart_putstring((const uint8_t*) "lfk init\r\n"); // Start execution timers_start(); advertising_start(); simple_uart_putstring((const uint8_t*) "main\r\n"); // Enter main loop for (;;) { app_sched_execute(); power_manage(); } }
/**@brief Application main function. */ int main(void) { uint32_t err_code; timers_init(); gpiote_init(); buttons_init(); if (is_first_start()) { // The startup was not because of button presses. This is the first start. // Go into System-Off mode. // NOTE: This register cannot be set directly after ble_stack_init() because the SoftDevice // will be enabled. GPIO_WAKEUP_BUTTON_CONFIG(HR_INC_BUTTON_PIN_NO); GPIO_WAKEUP_BUTTON_CONFIG(HR_DEC_BUTTON_PIN_NO); NRF_POWER->SYSTEMOFF = 1; } bond_manager_init(); ble_stack_init(); radio_notification_init(); // Initialize Bluetooth Stack parameters gap_params_init(); advertising_init(); services_init(); conn_params_init(); sec_params_init(); // Actually start advertising advertising_start(); // Enter main loop for (;;) { // Switch to a low power state until an event is available for the application err_code = sd_app_event_wait(); APP_ERROR_CHECK(err_code); } }
void BLE_Primx_Apps_Int(void) { leds_init(); // configure LED output timers_init(); // configure Timer gpiote_init(); // configure maximum no of GPIO external buttons_init(); // configure the button handlering and button proporty bond_manager_init(); // load the previous bond data from flash ble_stack_init(); // Install BLE event Handler function list gap_params_init(); // set gap parameter advertising_init(BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE); //set advertising mode, set UUID service services_init(); // add UUID service , and service function handler conn_params_init(); // set the connection parameter sec_params_init(); // set the security connect parameter radio_notification_init(); // active radio // Start execution advertising_start(); // start state mechine for adversting }
/**@brief Application main function. */ int main(void) { uint32_t err_code; connected = false; mlog_init(); timers_init(); gpiote_init(); buttons_init(); step_counter_init(); motor_init(); led1_init(); mlog_str("Starting MAIN...\r\n"); bond_manager_init(); ble_stack_init(); radio_notification_init(); // Initialize Bluetooth Stack parameters gap_params_init(); advertising_init(); services_init(); conn_params_init(); sec_params_init(); // Actually start advertising //advertising_start(); app_button_enable(); // Enter main loop for (;;) { // Switch to a low power state until an event is available for the application err_code = sd_app_event_wait(); APP_ERROR_CHECK(err_code); } }