My ELEC2645 project. Nikollao Sulollari. 200804685

Dependencies:   N5110 SoftPWM mbed

Fork of Treasure_Hunt by ELEC2645 (2015/16)

Revision:
5:ffa498d7071f
Parent:
4:f31bdc212241
Child:
6:c11bb31a06b3
--- a/main.h	Thu Mar 24 11:46:35 2016 +0000
+++ b/main.h	Sat Mar 26 14:41:40 2016 +0000
@@ -1,3 +1,21 @@
+/**
+@file main.h
+@brief Header file contains functions and variables
+@brief Treasure Hunt - Embedded Systems Project
+@brief Revision 1.0
+@author Nikollao Sulollari
+@Date 26/03/2016
+*/
+
+#ifndef MAIN_H
+#define MAIN_H
+#include "mbed.h"
+
+
+/**
+@nameSpace led
+@brief GPO output for status of LED
+*/
 DigitalOut r_led(LED_RED);
 DigitalOut g_led(LED_GREEN);
 DigitalOut b_led(LED_BLUE);
@@ -11,48 +29,150 @@
 AnalogIn yPot(PTB10);
 PwmOut speaker(PTC11);
 
+/**
+Displays an error message
+*/
 void error();
-// setup serial port
+
+/**
+set-up serial port
+*/
 void init_serial();
-// set-up the on-board LEDs and switches
+
+/**
+ set-up the on-board LEDs and switches
+*/
 void init_K64F();
+
+/**
+Set-up random variables and game menu
+*/
 void init_game();
+
+/**
+Set-up flag to 1
+*/
+
+/**
+Set-up flag to 1
+*/
 void timer_isr();
+
+/**
+Set-up flag to 1
+*/
+
+/**
+Set-up flag to 1
+*/
 void game_timer_isr();
+
+/**
+Set-up flag to 1
+*/
 void sw2_isr();
+
+/**
+Set-up flag to 1
+*/
 void sw3_isr();
+
+/**
+Set-up flag to 1
+*/
 void button_isr();
+
+/**
+Set-up flag to 1
+*/
 void timeout_isr();
 
+/**
+Set current position to default position of Joystick
+*/
 void calibrateJoystick();
+
+/**
+Update the values of the joystick to get current position
+*/
 void updateJoystick();
 
+/**
+Create an enemy rectangular shape
+*/
 void enemyRect();
+
+/**
+Create circle shape enemy
+*/
 void enemyCircle();
+
+/**
+creates the hero of the game
+*/
 void hero();
+
+/**
+Shows the right direction
+*/
 void guidance();
+
+/**
+Locates obstacles in the screen
+*/
 void obstacles();
+
+/**
+Gets enemies depending on the level
+*/
 void enemies();
+
+/**
+Get s vslue of the .y position, control menu
+*/
 int menu();
-bool intersection(int i, int j);
 
-volatile int rectY;
-volatile int rectX ;
-volatile int circleX;
-volatile int circleY;
-volatile int heroX;
-volatile int heroY;
+/**
+Check for intrersection
+@param i loops through x direction
+@param j loops through y direction
+@returns the number of pixels aroun the hero detected
+*/
+int intersection(int i, int j);
+
+volatile int rectY; /*! <set the Y coordinate of the rectangular enemy> */
+
+volatile int rectX ;/*! <set the X coordinate of the rectangular enemy> */
+
+volatile int circleX;/*! <set the Y coordinate of the circular enemy> */
+
+volatile int circleY;/*! <set the X coordinate of the circular enemy> */
+
+volatile int heroX;/*! <set the X coordinate of the hero> */
+
+volatile int heroY;/*! <set the Y coordinate of the hero> */
+
+volatile int level = 0; /*! <set level of the game> */
 
-volatile int level = 0;
-volatile int g_timer_flag = 0;
-volatile int g_game_timer_flag = 0;
-volatile int g_sw2_flag = 0;
-volatile int g_sw3_flag = 0;
-volatile int g_button_flag = 0;
-volatile int option = 0;
-volatile int play = 0;
+volatile int g_timer_flag = 0; /*! <set timer flag in the isr, timer trigger interrupt> */
+
+volatile int g_game_timer_flag = 0;  /*! <set timer flag in the isr, timer trigger interrupt> */
+
+volatile int g_sw2_flag = 0;  /*! <set timer flag in the isr, event trigger interrupt> */
+
+volatile int g_sw3_flag = 0;  /*! <set timer flag in the isr, event trigger interrupt> */
+
+volatile int g_button_flag = 0;  /*! <set timer flag in the isr, event trigger interrupt> */
 
-int reset = 0;
+volatile int option = 0;  /*! <set option to generate menut> */
+
+volatile int play = 0; /*! <used as a variable to check if its the first try*/
+
+volatile int tries = 0;/*! <saves number of trials> */
 
+int reset = 0; /*! <updates level of the game> */
 
+int check[10][10];/*! <array used to check for intersection> */
 
+#endif
+