Example #1
0
int main(void)
{
    // If transport layer is using UART with flow control we need to get one
    // GPIOTE user for the CTS wakeup pin.
    APP_GPIOTE_INIT(1);

    leds_init();

    // Indicate that the application has started up. This can be used to verify that
    // application resets if reset button is pressed or the chip has been reset with
    // a debugger. The led will be off during reset.
    nrf_gpio_pin_set(MAIN_FUNCTION_LED_PIN_NO);

    connectivity_chip_reset();

    bluetooth_init();

    // Enter main loop.
    for (;;)
    {
        uint32_t err_code;

        // Start/restart advertising.
        if (m_start_adv_flag)
        {
            err_code = sd_ble_gap_adv_start(&m_adv_params);
            APP_ERROR_CHECK(err_code);
            nrf_gpio_pin_set(ADVERTISING_LED_PIN_NO);
            m_start_adv_flag = false;
        }

        // Power management.
        power_manage();
    }
}
Example #2
0
/**@brief Application main function.
 */
int main(void)
{
    APP_GPIOTE_INIT(1); 
    connectivity_chip_reset();
    
    leds_init();
    buttons_init();    
    bond_manager_init();
    ble_stack_init();
    ble_error_log_init();
    timers_init();
    nrf_gpio_pin_set(NRF6310_LED_5);
    gap_params_init();
    nrf_gpio_pin_clear(NRF6310_LED_5);
    advertising_init();
    services_init();
    sensor_sim_init();
    conn_params_init();
    sec_params_init();
    radio_notification_init();
   
    // Start execution
    application_timers_start();
    //m_start_adv_flag = true;
    advertising_start();
    
    // Enter main loop
    for (;;)
    {
//         uint32_t err_code;
//         // Start/restart advertising.
//         if (m_start_adv_flag)
//         {
//             err_code = sd_ble_gap_adv_start(&m_adv_params);
//             APP_ERROR_CHECK(err_code);
//             nrf_gpio_pin_set(ADVERTISING_LED_PIN_NO);
//             m_start_adv_flag = false;
//         }
        power_manage();
    }
}