Example #1
0
void waitFor(uint8_t button)
{
    debounceButtons();
    while (!justReleased(button))
    {
        debounceButtons();
    }
}
Example #2
0
// This is invoked in response to a timer interrupt.
// This code is used for everything that needs to
// use precise timing. It is split into many function
// for readability.
void timer_interrupt_handler() {

	// Increment the following counters:
	fit_timer_count++;
	debounce_timer_count++;
	alien_explosion_count++;

	checkGameOver();			// Check to see if the aliens have reached the bottom.
	alienBulletsCreate();		// Create a new alien bullet, if possible.
	saucerUpdate();				// Move the saucer.
	debounceButtons();			// Debounce the push buttons, and then move the tank and/or fire.
	checkExplosion();			// Handle alien explosions.
	updateAllBullets();			// Update both the tank and alien bullets.
	updateAlienBlock();			// Update the alien block position.
	updateSaucerFlashing();		// Update if the saucer is hit and should be flashing.
	updateTankFlashing();		// Update if the tank is hit and should be flashing.
	resetDebouncer();			// Reset the debouncer timer if no buttons are pressed.
}