Simple (basic) snake game

Dependencies:   N5110 mbed

Revision:
1:ab8ceac59e71
Parent:
0:9eb93eff2469
Child:
2:dbfe6019b558
--- a/main.h	Sun May 08 20:10:54 2016 +0000
+++ b/main.h	Sun May 08 21:42:25 2016 +0000
@@ -9,7 +9,7 @@
 
 #include "mbed.h"
 #include "N5110.h"
-#define DIRECTION_TOLERANCE 0.05
+#define DIRECTION_TOLERANCE 0.01
 
 // LCD Object
 N5110 lcd(PTE26 , PTA0 , PTC4 , PTD0 , PTD2 , PTD1 , PTC3);
@@ -23,11 +23,12 @@
 DigitalIn joy_button(PTB11); //  needs pull-down (active high)
 InterruptIn pcb_button(PTB18); // needs pull-down (active high)
 // PWM Output (LED and Buzzer)
-PwmOut pcb_led(PTC2); //
-PwmOut pcn_buzzer(PTA2);
+PwmOut pcb_led(PTC2);
+PwmOut pcb_buzzer(PTA2);
 
 // Ticker for joystick update
 Ticker joystick_update_ticker;
+Ticker brightness_update_ticker;
 
 // Initialising board board
 void init_K64F();
@@ -73,12 +74,14 @@
 GAME_STATES game_state = INIT; // Default state of the game
 
 // Global variables
-volatile int g_pcb_button_flag = 0; 
+volatile int g_pcb_button_flag = 0;
+volatile float g_lcd_bright_level = 0;
 
 // Function prototypes
 void calibrateJoystick();
 void updateJoystick();
-void snake_game();
+void updateBrightness();
+void snakeGame();
 
 // These functions are used to map game
 // field of 20x11 to the LCD screen which is 84x48
@@ -94,4 +97,6 @@
 // Place an apple at random location (returns food structure)
 AppleType placeRandomApple();
 // pcb_button interrupt function
-void pcb_button_isr();
\ No newline at end of file
+void pcb_button_isr();
+// This function make LED blink and buzzer make a sound
+void blinkLEDandBuzz();
\ No newline at end of file