App Timer does not trigger his handle function

Hi,

I'm trying to implement a timer that will trigger each 10ms (for example) an handler function and do something inside it. So, I came with the idea to implement an App Timer as follow :

#define OSCILLATION_INTERVAL APP_TIMER_TICKS(10)
  
APP_TIMER_DEF(m_app_timer_id);

static void app_timer_handler(void *p_context)
{
  NRF_LOG_INFO("YES");
}

static void timer_init(void)
{
    ret_code_t err_code;

    err_code = app_timer_create(&m_app_timer_id, APP_TIMER_MODE_REPEATED, app_timer_handler);
    APP_ERROR_CHECK(err_code);
}

static void idle_state_handle(void)
{
    if (NRF_LOG_PROCESS() == false)
    {
        nrf_pwr_mgmt_run();
    }
}

int main(void)
{
    bool erase_bonds;
    ret_code_t err_code;
    
    // Initialize.
    log_init();
    app_timer_init();
    NRF_LOG_INFO("START");
    timer_init();
    // Enter main loop. 
    err_code = app_timer_start(m_app_timer_id, OSCILLATION_INTERVAL, NULL);
    APP_ERROR_CHECK(err_code);
    for (;;)
    {   
        idle_state_handle();
    }
}

My issue is that I don't read the "Yes" charachter in the debug terminal, so I guees that my timer is not working correctly.
I tried to find the solution, but didn't find where my error is...

Thanks for helping !

Chris

Parents Reply Children
No Data
Related