Hi Nordic,
I am using SDK 12.3.0, S130 2.0.1 and PCA10028 nrf51 DK.
I want to ask how to use app timer with scheduler.
Here is my implementation. I just use APP_TIMER_APPSH_INIT in stead of APP_TIMER_INIT.
Is it sufficient to use app timer with scheduler. It works but I don't know the timer interrupt have be put into scheduler queue or not.
#define APP_TIMER_PRESCALER 0
#define APP_TIMER_OP_QUEUE_SIZE 2
#define SCHED_MAX_EVENT_DATA_SIZE sizeof(app_timer_event_t)
#define SCHED_QUEUE_SIZE 10
APP_TIMER_DEF(m_timer_id);
void function1(void)
{
//Start 15s timer if called
app_timer_start(m_timer_id, APP_TIMER_TICKS(15000, APP_TIMER_PRESCALER), NULL);
}
void function2(void)
{
//Stop timer if called
app_timer_stop(m_timer_id);
}
static void timer_timeout_handler(void * p_context)
{
//Do something
}
int main(void)
{
APP_TIMER_APPSH_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, true);
uint32_t err_code = app_timer_create(&m_timer_id,
APP_TIMER_MODE_SINGLE_SHOT,
timer_timeout_handler);
APP_SCHED_INIT(SCHED_MAX_EVENT_DATA_SIZE, SCHED_QUEUE_SIZE);
function1();
for(;;)
{
power_manage();
app_sched_excute();
}
}