/** * Find the display queue entry with the highest priority. */ struct deff_queue_entry *deff_queue_find_priority (void) { struct deff_queue_entry *dq = deff_queue; struct deff_queue_entry *answer = NULL; U8 highest_prio = PRI_NULL; do { if (dq->id != DEFF_NULL) { const deff_t *deff; if (time_reached_p (dq->timeout)) { /* This queued effect already expired, so we will ignore it and free it. */ dq->id = dq->timeout = 0; } else { deff = &deff_table[dq->id]; if (deff->prio > highest_prio) { answer = dq; highest_prio = deff->prio; } } } } while (++dq < deff_queue + MAX_QUEUED_DEFFS); return answer; }
/** Runs the periodic functions. This function is called * about once every 16ms, but it may run less often when * there are many tasks running. */ void do_periodic (void) { /* Switch processing is special, and will be called as often as possible. Everything else is called less frequently. */ switch_periodic (); /* See if at least 100ms has elapsed. If so, we advance the timeout for the next check. If more than 200ms elapsed, we will only process 1 'tick' on the current call, and do it again on the next run. */ if (time_reached_p (idle_ready_time)) idle_ready_time += TIME_100MS; else return; /* Throw the 100ms event */ callset_invoke (idle_every_100ms); /* Throw the 1 second event every 10 calls */ idle_second_timer++; if (idle_second_timer >= 10) { idle_second_timer -= 10; callset_invoke (idle_every_second); /* Throw the 10 second event if that has elapsed */ idle_10second_timer++; if (idle_10second_timer >= 10) { idle_10second_timer -= 10; callset_invoke (idle_every_ten_seconds); #ifndef CONFIG_RTC idle_minute_timer++; if (idle_minute_timer >= 6) { idle_minute_timer -= 6; callset_invoke (minute_elapsed); } #endif } } }