Exemple #1
0
int main(void) {
  init();
  alarm_init();
  clock_init();
  display_init();

  sei();

  for(;;) {
    clock_update();
    buttons_update();

    handle_buttons();
    handle_display();
    handle_led();

    buttons_age();
    clock_ticked = false;

    // Check display timeout
    if (mode != mode_off || status != status_none || !clock_set) { // Need the main clock
      set_sleep_mode(SLEEP_MODE_IDLE);
    } else {
      set_sleep_mode(SLEEP_MODE_PWR_SAVE);
    }
    sleep_enable();
    sleep_cpu();
    sleep_disable();
  }
}
Exemple #2
0
void game_frame()
{
	handle_input();
	handle_display();
}