Exemple #1
0
/**@brief Function for application main entry, does not return.
 * 
 * @details The main function will do all necessary initalization. This includes sdm rx module 
 * and softdevice. 
 */ 
int main(void)
{
    uint32_t err_code;
    
    // In case of logging enabled, we enable sdm_rx module first.
    err_code = sdm_rx_init();
    APP_ERROR_CHECK(err_code);
  
    // Enable softdevice.
    err_code = sd_softdevice_enable(NRF_CLOCK_LFCLKSRC_XTAL_50_PPM, softdevice_assert_callback);
    APP_ERROR_CHECK(err_code);

    // Set application IRQ to lowest priority.
    err_code = sd_nvic_SetPriority(PROTOCOL_EVENT_IRQn, NRF_APP_PRIORITY_LOW); 
    APP_ERROR_CHECK(err_code);
  
    // Enable application IRQ (triggered from protocol).
    err_code = sd_nvic_EnableIRQ(PROTOCOL_EVENT_IRQn);      
    APP_ERROR_CHECK(err_code);

    // Setup Channel_0 as a SDM RX.
    ant_channel_sdm_rx_setup();
  
    sdm_main_loop();
}
Exemple #2
0
/**@brief Function for application main entry, does not return.
 *
 * @details The main function will do all necessary initalization. This includes sdm rx module
 * and SoftDevice.
 */
int main(void)
{
    uint32_t err_code;

#if defined(TRACE_UART)
    app_uart_comm_params_t comm_params =
    {
        RX_PIN_NUMBER,
        TX_PIN_NUMBER,
        RTS_PIN_NUMBER,
        CTS_PIN_NUMBER,
        APP_UART_FLOW_CONTROL_DISABLED,
        false,
        UART_BAUDRATE_BAUDRATE_Baud38400
    };

    APP_UART_FIFO_INIT(&comm_params,
                       UART_RX_BUF_SIZE,
                       UART_TX_BUF_SIZE,
                       uart_error_handle,
                       APP_IRQ_PRIORITY_LOW,
                       err_code);
    APP_ERROR_CHECK(err_code);
#endif // TRACE_UART
#if defined(TRACE_GPIO)
    // Initialize timer module.
    APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_MAX_TIMERS, APP_TIMER_OP_QUEUE_SIZE, false);

    err_code = bsp_init(BSP_INIT_LED, APP_TIMER_TICKS(100, APP_TIMER_PRESCALER), NULL);
    APP_ERROR_CHECK(err_code);
#endif // TRACE_GPIO

    // In case of logging enabled, we enable sdm_rx module first.
    err_code = sdm_rx_init();
    APP_ERROR_CHECK(err_code);

    // Enable SoftDevice.
    err_code = sd_softdevice_enable(NRF_CLOCK_LFCLKSRC_XTAL_50_PPM, softdevice_assert_callback);
    APP_ERROR_CHECK(err_code);

    // Set application IRQ to lowest priority.
    err_code = sd_nvic_SetPriority(SD_EVT_IRQn, NRF_APP_PRIORITY_LOW);
    APP_ERROR_CHECK(err_code);

    // Enable application IRQ (triggered from protocol).
    err_code = sd_nvic_EnableIRQ(SD_EVT_IRQn);
    APP_ERROR_CHECK(err_code);

    err_code = ant_stack_static_config();
    APP_ERROR_CHECK(err_code);

    // Setup Channel_0 as a SDM RX.
    ant_channel_sdm_rx_setup();

    sdm_main_loop();
}