ELEC2645 (2015/16) / Mbed 2 deprecated ELEC2645FinalProject

Dependencies:   N5110 SDFileSystem mbed

Embed: (wiki syntax)

« Back to documentation index

main.h File Reference

main.h File Reference

Header file containing functions prototypes, defines and global variables. More...

Go to the source code of this file.

Namespaces

namespace  red_led
 

GPIO output for game-over LED.


namespace  green_led
 

GPIO output for game-playing LED.


namespace  N5110_lcd
 

GPIO output for Nokia screen.


namespace  yellowLED
 

GPIO output for collision warning.


namespace  greenLED
 

GPIO output for eating food.


namespace  xPot
 

GPIO output for joystick in x plane.


namespace  yPot
 

GPIO output for joystick in y plane.


namespace  buzzer
 

GPIO output for buzzer.


namespace  volume
 

GPIO output for potentiometer.


namespace  sd
 

GPIO output for SDcard.


Functions

void nextFrame ()
 Sets flag for bringing the next frame.
void timerTrigger ()
 Sets the bool timerDone as true.
void screenDelay (float seconds)
 Timeout which keeps the program at one point for a while.
void greenOff ()
 Turns off external green LED.
bool checkCollision (int x, int y)
 Checks is snake has hit wall or self.
void calibrateJoystick ()
 read default positions of the joystick to calibrate later readings
void updateJoystick ()
 read current joystick values relative to calibrated values and calculate direction depending on x,y values
void snake ()
 Contains all of the snake code.

Variables

volatile int playerLength
volatile int playerPositionsX [maxPlayerSize]
volatile int playerPositionsY [maxPlayerSize]
volatile int areaWidth = 41
volatile int areaHeight = 19

Detailed Description

Header file containing functions prototypes, defines and global variables.

Author:
John A. C. Richards
Date:
April 20156

Definition in file main.h.


Function Documentation

void calibrateJoystick (  )

read default positions of the joystick to calibrate later readings

Definition at line 344 of file main.cpp.

bool checkCollision ( int  x,
int  y 
)

Checks is snake has hit wall or self.

Parameters:
x- set x plane
y- set y plane
Returns:
true or false

Definition at line 397 of file main.cpp.

void greenOff (  )

Turns off external green LED.

Definition at line 392 of file main.cpp.

void nextFrame (  )

Sets flag for bringing the next frame.

Definition at line 418 of file main.cpp.

void screenDelay ( float  seconds )

Timeout which keeps the program at one point for a while.

Parameters:
secondsTime delayed, in seconds

Definition at line 382 of file main.cpp.

void snake (  )

Contains all of the snake code.

Definition at line 56 of file main.cpp.

void timerTrigger (  )

Sets the bool timerDone as true.

Definition at line 377 of file main.cpp.

void updateJoystick (  )

read current joystick values relative to calibrated values and calculate direction depending on x,y values

Definition at line 351 of file main.cpp.


Variable Documentation

volatile int areaHeight = 19

height of game map

Definition at line 88 of file main.h.

volatile int areaWidth = 41

width of game map

Definition at line 87 of file main.h.

volatile int playerLength

length of player

Definition at line 82 of file main.h.

volatile int playerPositionsX[maxPlayerSize]

max player size x

Definition at line 84 of file main.h.

volatile int playerPositionsY[maxPlayerSize]

max player size y

Definition at line 85 of file main.h.