Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Where is the APP_TIMER_INIT() macro referred to at line 61 of app_timer.h?

sdk5 15.2's app_timer.h at line 61 says:

 * @details Use the USE_SCHEDULER parameter of the APP_TIMER_INIT() macro to select if the
 *          @ref app_scheduler should be used or not. Even if the scheduler is
 *          not used, app_timer.h will include app_scheduler.h, so when
 *          compiling, app_scheduler.h must be available in one of the compiler include paths.

Is the reference cruft from an earlier SDK superseded by the APP_TIMER_CONFIG_USE_SCHEDULER knob?

The same reference is in the html docs at https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v15.2.0%2Fgroup__app__scheduler.html

Thanks, Howard

Parents
  • I use this in app_timer.c, but it's not a macro:

       // Initialize
       err_code = app_timer_init();
       APP_ERROR_CHECK(err_code);
    
    ret_code_t app_timer_init(void)
    {
        // Stop RTC to prevent any running timers from expiring (in case of reinitialization)
        rtc1_stop();
    
        // Initialize operation queue
        m_op_queue.first           = 0;
        m_op_queue.last            = 0;
        m_op_queue.size            = APP_TIMER_CONFIG_OP_QUEUE_SIZE+1;
    
        mp_timer_id_head            = NULL;
        m_ticks_elapsed_q_read_ind  = 0;
        m_ticks_elapsed_q_write_ind = 0;
    
    #if APP_TIMER_WITH_PROFILER
        m_max_user_op_queue_utilization   = 0;
    #endif
    
        NVIC_ClearPendingIRQ(SWI_IRQn);
        NVIC_SetPriority(SWI_IRQn, SWI_IRQ_PRI);
        NVIC_EnableIRQ(SWI_IRQn);
    
        rtc1_init(APP_TIMER_CONFIG_RTC_FREQUENCY);
    
        m_ticks_latest = rtc1_counter_get();
    
        return NRF_SUCCESS;
    }
    

Reply
  • I use this in app_timer.c, but it's not a macro:

       // Initialize
       err_code = app_timer_init();
       APP_ERROR_CHECK(err_code);
    
    ret_code_t app_timer_init(void)
    {
        // Stop RTC to prevent any running timers from expiring (in case of reinitialization)
        rtc1_stop();
    
        // Initialize operation queue
        m_op_queue.first           = 0;
        m_op_queue.last            = 0;
        m_op_queue.size            = APP_TIMER_CONFIG_OP_QUEUE_SIZE+1;
    
        mp_timer_id_head            = NULL;
        m_ticks_elapsed_q_read_ind  = 0;
        m_ticks_elapsed_q_write_ind = 0;
    
    #if APP_TIMER_WITH_PROFILER
        m_max_user_op_queue_utilization   = 0;
    #endif
    
        NVIC_ClearPendingIRQ(SWI_IRQn);
        NVIC_SetPriority(SWI_IRQn, SWI_IRQ_PRI);
        NVIC_EnableIRQ(SWI_IRQn);
    
        rtc1_init(APP_TIMER_CONFIG_RTC_FREQUENCY);
    
        m_ticks_latest = rtc1_counter_get();
    
        return NRF_SUCCESS;
    }
    

Children
Related