Most application examples which use the scheduler have a main loop looking something like this,
int main(void)
{
// Initialization <snipped>
// Enter main loop.
for (;;)
{
app_sched_execute();
if (NRF_LOG_PROCESS() == false)
{
ret_code_t err_code = sd_app_evt_wait(); // or __WFE() if no soft device is used
APP_ERROR_CHECK(err_code);
}
}
}
Clearly if an interrupt routine pushes an event using app_sched_event_put()
then the application will wake from sd_app_event_wait()
and the event handler will be executed when the main loop calls app_sched_execute()
.
What happens though if the main loop itself (or an event handler executing in the main context via an app_sched_execute()
call) pushes an event to the queue but no subsequent interrupt occurs? Does the application then remain asleep with the pushed event stuck in the queue?
I assume this is the case, but just wanted to confirm, as it suggests perhaps using a timer to periodically schedule execution of a "master" application event hander / state machine which then processes events (e.g., bit-flags) set by the various app_sched_execute()
'ed handlers.
Thanks!