How can I use my own scheduler with app_timer?

Hello everyone,

This might be a somewhat silly question. I'm trying to use SDK v17.1, and have an issue with the app_timer library.

I remember that before SDK v13 one would init app_timer with the APP_TIMER_INIT() macro, and there one should input the event scheduler, but now the macro has been removed, and the app_timer lib doesn't have a way to define a custom scheduler, as far as i know.

I have my own event scheduler in my code, it's a simple task queue, and back in SDK v11 I would use task_queue_post() to schedule the corresponding task.

uint32_t event_handler(app_timer_timeout_handler_t timeout_handler,
void * p_context)
{
return task_queue_post(timeout_handler, p_context);
}


// Initialize app_timer.
APP_TIMER_INIT(TIMER_PRESCALER, OP_QUEUES_SIZE, event_handler);

I was just wondering if someone could tell me how can i keep using my own task scheduler, since as far as i'm concerned one can use app_timer with app_scheduler, but I'd like to use my very own scheduler instead.

Thanks for your help

Parents
  • Hello,

    The app timer library was rewritten as app_timer2.  Unfortunately it no longer supports user provided scheduler functions. However, it can optionally be used with app_scheduler by enabling the APP_TIMER_CONFIG_USE_SCHEDULER setting in sdk_config.h. Is it an alternative to just add your tasks to your scheduler from the app timer interrupts instead?

    Best regards,

    Vidar

Reply
  • Hello,

    The app timer library was rewritten as app_timer2.  Unfortunately it no longer supports user provided scheduler functions. However, it can optionally be used with app_scheduler by enabling the APP_TIMER_CONFIG_USE_SCHEDULER setting in sdk_config.h. Is it an alternative to just add your tasks to your scheduler from the app timer interrupts instead?

    Best regards,

    Vidar

Children
Related