Пример #1
0
Файл: main.c Проект: IOIOI/nRF51
/* Main function */
int main(void)
{
    uint32_t err_code;
    nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC;
    
    utils_setup();
    
    // Setup SoftDevice and events handler
    err_code = softdevice_ant_evt_handler_set(continuous_scan_event_handler);
    APP_ERROR_CHECK(err_code);

    err_code = softdevice_handler_init(&clock_lf_cfg, NULL, 0, NULL);
    APP_ERROR_CHECK(err_code);

    err_code = ant_stack_static_config();
    APP_ERROR_CHECK(err_code);
        
    continuous_scan_init();

    err_code = app_timer_create(&m_scan_timer_id,
                                APP_TIMER_MODE_SINGLE_SHOT,
                                scan_timeout_event);
    APP_ERROR_CHECK(err_code);

    // Enter main loop
    for (;;)
    {
        err_code = sd_app_evt_wait();
        APP_ERROR_CHECK(err_code);
    }
}
Пример #2
0
Файл: main.c Проект: IOIOI/nRF51
/**@brief Function for application main entry. Does not return.
 */ 
int main(void)
{

    utils_setup();
    softdevice_setup();
    ant_channel_tx_broadcast_setup();

    // Main loop. 
    for (;;)
    {
#ifdef CPU_LOAD_TRACE
        // Disabling interrupts in this way is highly not recommended. It has an impact on the work
        // of the softdecive and it is used only in order to show CPU load.
        __disable_irq();
        LEDS_OFF(BSP_LED_0_MASK);
        __WFI();
        LEDS_ON(BSP_LED_0_MASK);
        __enable_irq();
#else
        // Put CPU in sleep if possible. 
        uint32_t err_code = sd_app_evt_wait();
        APP_ERROR_CHECK(err_code);
#endif // CPU_LOAD_TRACE
    }
}
Пример #3
0
Файл: main.c Проект: IOIOI/nRF51
/**@brief Function for application main entry. Does not return.
 */
int main(void)
{
    uint32_t err_code;
    nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC;

    // Setup buttons and timer
    utils_setup();

    LEDS_CONFIGURE(LEDS_MASK);

    // Setup SoftDevice and events handler
    err_code = softdevice_ant_evt_handler_set(ant_async_tx_event_handler);
    APP_ERROR_CHECK(err_code);

    err_code = softdevice_handler_init(&clock_lf_cfg, NULL, 0, NULL);
    APP_ERROR_CHECK(err_code);

    err_code = ant_stack_static_config();
    APP_ERROR_CHECK(err_code);

    // Setup async tx channel
    ant_async_tx_setup(APP_TIMER_PRESCALER);

    // Enter main loop
    for (;;)
    {
        err_code = sd_app_evt_wait();
        APP_ERROR_CHECK(err_code);
    }
}
Пример #4
0
Файл: main.c Проект: IOIOI/nRF51
/**@brief Function for application main entry. Does not return.
 */
int main(void)
{
    uint32_t err_code;
    nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC;

    utils_setup();

    // Enable SoftDevice.
    err_code = softdevice_ant_evt_handler_set(ant_evt_dispatch);
    APP_ERROR_CHECK(err_code);

    err_code = softdevice_handler_init(&clock_lf_cfg, NULL, 0, NULL);
    APP_ERROR_CHECK(err_code);

    err_code = ant_stack_static_config();
    APP_ERROR_CHECK(err_code);

    // Setup and open Channel_0 as a Bidirectional Master.
    app_channel_setup();

    #ifdef INCLUDE_DEBUG_CHANNEL
    // Setup and open Debug Channel
    ad_init();
    ad_register_custom_command_callback(app_custom_debug_command_handler);
    #endif

    // Enter main loop
    for (;;)
    {
        err_code = sd_app_evt_wait();
        APP_ERROR_CHECK(err_code);
    }
}
Пример #5
0
/**@brief Function for application main entry. Does not return.
 */
int main(void)
{
    uint32_t err_code;
    nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC;

    utils_setup();

    // Setup SoftDevice and events handler
    err_code = softdevice_ant_evt_handler_set(ant_io_tx_event_handler);
    APP_ERROR_CHECK(err_code);

    err_code = softdevice_handler_init(&clock_lf_cfg, NULL, 0, NULL);
    APP_ERROR_CHECK(err_code);

    err_code = ant_stack_static_config();
    APP_ERROR_CHECK(err_code);

    // Setup and start ANT channel
    ant_io_tx_setup();

    // Enter main loop.
    for (;;)
    {
        err_code = sd_app_evt_wait();
        APP_ERROR_CHECK(err_code);
    }
}
Пример #6
0
/**@brief Function for application main entry, does not return.
 */
int main(void)
{
    uint32_t err_code;

    utils_setup();
    softdevice_setup();
    ant_state_indicator_init( m_ant_hrm.channel_number, HRM_TX_CHANNEL_TYPE);
    profile_setup();

    for (;;)
    {
        err_code = sd_app_evt_wait();
        APP_ERROR_CHECK(err_code);
    }
}
Пример #7
0
Файл: main.c Проект: IOIOI/nRF51
/** @brief The main function
 */
int main(void)
{
    uint32_t err_code;

    switch_init();
    utils_setup();
    softdevice_setup();

    sf_init();

    // Enter main loop
    for (;;)
    {
        err_code = sd_app_evt_wait();
        APP_ERROR_CHECK(err_code);
    }
}
Пример #8
0
/**@brief Function for application main entry, does not return.
 */
int main(void)
{
    uint32_t err_code;

    utils_setup();
    softdevice_setup();
    ant_state_indicator_init(m_ant_bpwr.channel_number, BPWR_DISP_CHANNEL_TYPE);
    profile_setup();

    for (;; )
    {
        if (NRF_LOG_PROCESS() == false)
        {
            err_code = sd_app_evt_wait();
            APP_ERROR_CHECK(err_code);
        }
    }
}
Пример #9
0
/**@brief Function for application main entry. Does not return.
 */
int main(void)
{
    uint32_t err_code;

    softdevice_setup();

    utils_setup();

    // Setup as an RX Slave.
    ant_se_channel_rx_broadcast_setup();

    // Main loop.
    for (;;)
    {
        // Put CPU in sleep if possible
        err_code = sd_app_evt_wait();
        APP_ERROR_CHECK(err_code);
    }
}
Пример #10
0
/**@brief Function for application main entry, does not return.
 */
int main(void)
{
		bool erase_bonds;
		uint32_t err_code;
	
	
    utils_setup(&erase_bonds);
	  softdevice_and_stack_setup();
	
	  //ANT
    
	 
		//BLE
	
    // Initialize BLE STACK parameters
    gap_params_init();
		advertising_init();
    services_init();
    conn_params_init();

	

    // Start execution.
    application_timers_start();
    err_code = ble_advertising_start(BLE_ADV_MODE_FAST);
		profile_setup();
    APP_ERROR_CHECK(err_code);

		device_manager_init(erase_bonds);


    for (;; )
    {
        power_manage();
    }
}