From 456f5768fdcc6e1e94a2fde72870216bc7c13f39 Mon Sep 17 00:00:00 2001 From: Alvaro Date: Wed, 27 Jul 2011 19:18:06 +0100 Subject: [PATCH] effects: use timer tick --- zetris/zetris.pde | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/zetris/zetris.pde b/zetris/zetris.pde index f0afb5e..42339c0 100644 --- a/zetris/zetris.pde +++ b/zetris/zetris.pde @@ -66,6 +66,8 @@ static bool currentpiecevalid=false; /* Colors for current and next piece */ static color_type *currentcolor, *nextcolor; +static unsigned int timerTicks = 0; + const int OPERATION_CLEAR=0; const int OPERATION_DRAW=1; @@ -242,6 +244,7 @@ void _zpu_interrupt() } } #endif + timerTicks++; TMR0CTL &= ~(BIT(TCTLIF)); } @@ -557,7 +560,10 @@ void waitTick() sync(); usleep(100000); #endif - delay(100); + timerTicks = 0; + while ( timerTicks < 5 ) { + audiofill(); + } } void special_effects(int y)