My ELEC2645 project. Nikollao Sulollari. 200804685
Dependencies: N5110 SoftPWM mbed
Fork of Treasure_Hunt by
main.h
- Committer:
- Nikollao
- Date:
- 2016-03-28
- Revision:
- 6:c11bb31a06b3
- Parent:
- 5:ffa498d7071f
- Child:
- 7:f31a4b4beb91
File content as of revision 6:c11bb31a06b3:
/** @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); // K64F on-board switches InterruptIn sw2(SW2); InterruptIn sw3(SW3); InterruptIn button(PTB2); AnalogIn xPot(PTB3); AnalogIn yPot(PTB10); PwmOut speaker(PTC11); /** Displays an error message */ void error(); /** set-up serial port */ void init_serial(); /** 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(); //testing void checkOverlap(); void userTouched(); /** 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; /*!< used to determine x-axis position of the rect enemy */ volatile int rectX ;/*!< used to determine y-axis position of the rect enemy */ volatile int circleX;/*!< used to determine x-axis position of the circular enemy */ volatile int circleY;/*!< used to determine y-axis position of the circular enemy */ volatile int heroX;/*!< used to move the hero along x-axis */ volatile int heroY;/*!< used to move the hero along y-axis */ volatile int level = 0; /*!< initiate the level difficulty of the game */ 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 */ volatile int option = 0; /*!< select option in menu based on Joystick's movement */ volatile int play = 0; /*!< counts the number of plays */ volatile int tries = 0;/*!< counts the number of trials */ volatile int n;/*!< number of pixels overlapping */ int pixels[84][48]; int reset = 0; /*!< used to save current level of difficulty */ #endif