A retro gaming programme, designed for use on a portable embedded system. Incorporates power saving techniques.
Dependencies: ConfigFile N5110 PowerControl beep mbed
Diff: tower.h
- Revision:
- 38:2006c99bb1fc
- Parent:
- 37:eda13afa2923
- Child:
- 39:8cb510bb4f0b
--- a/tower.h Tue Apr 21 21:45:09 2015 +0000 +++ b/tower.h Tue Apr 21 21:56:57 2015 +0000 @@ -34,7 +34,7 @@ int FX = 0; //previous Direction -int preDir; +int preDirection; //timer flags to check state of the buttons int buttonFlagA = 0; @@ -927,9 +927,9 @@ printFlag = 0; if(joystick.direction==CENTRE) { - preDir=0; + preDirection=0; } - if (joystick.direction == UP && preDir==0) { + if (joystick.direction == UP ) { serial.printf(" UP\n"); state1 = state1--; if (state1 < 0)state1 = 0; @@ -937,10 +937,9 @@ if (state2 < 0)state2 = 0; state3 = state3--; if (state3 < 0)state3 = 0; - preDir=1; } //option down - if (joystick.direction == DOWN && preDir==0) { + if (joystick.direction == DOWN ) { serial.printf(" DOWN\n"); state1 = state1++; if (state1 > 26)state1 = 26; @@ -948,19 +947,18 @@ if (state2 > 26)state2 = 26; state3 = state3++; if (state3 > 26)state3 = 26; - preDir=1; } - if (joystick.direction == LEFT && preDir==0) { + if (joystick.direction == LEFT && preDirection==0) { serial.printf(" LEFT\n"); initial = initial--; if (initial < 0)initial = 0; - preDir=1; + preDirection=1; } - if (joystick.direction == RIGHT && preDir==0) { + if (joystick.direction == RIGHT && preDirection==0) { serial.printf(" RIGHT\n"); initial = initial++; if (initial > 2)initial = 2; - preDir=1; + preDirection=1; } //Centre / Unknown orientation if (joystick.direction == CENTRE)