Carter Montgomery / Mbed 2 deprecated 2035_Final_Project

Dependencies:   mbed wave_player 4DGL-uLCD-SE MMA8452

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers globals.h Source File

globals.h

00001 // ============================================
00002 // The header file for general project settings
00003 // Spring 2018 Gatech ECE2035
00004 //=============================================
00005 #ifndef GLOBAL_H
00006 #define GLOBAL_H
00007 #define WIDTH 
00008 #define HEIGHT
00009 
00010 // Include all the hardware libraries
00011 #include "mbed.h"
00012 #include "wave_player.h"
00013 #include "MMA8452.h"
00014 #include "uLCD_4DGL.h"
00015 #include "SDFileSystem.h"
00016 
00017 
00018 
00019 // Declare the hardware interface objects
00020 extern uLCD_4DGL uLCD;      // LCD Screen
00021 extern SDFileSystem sd;     // SD Card
00022 extern Serial pc;           // USB Console output
00023 extern MMA8452 acc;       // Accelerometer
00024 extern DigitalIn button1;   // Pushbuttons
00025 extern DigitalIn button2;
00026 extern DigitalIn button3;
00027 extern AnalogOut DACout;    // Speaker
00028 extern PwmOut speaker;
00029 extern wave_player waver;
00030 
00031 typedef struct{
00032     int x,y;    // Current locations
00033     int px, py; // Previous locations
00034     int has_key;
00035     int quest_complete;
00036     int rock_pushed;
00037     int health;
00038     int lives;
00039     int gems;
00040 }Player;
00041 
00042 // === [define the macro of error heandle function] ===
00043 // when the condition (c) is not true, assert the program and show error code
00044 #define ASSERT_P(c,e) do { \
00045     if(!(c)){ \
00046         pc.printf("\nERROR:%d\n",e); \
00047         while(1); \
00048     } \
00049 } while (0)
00050 
00051 // === [error code] ===
00052 #define ERROR_NONE 0 // All good in the hood
00053 #define ERROR_MEH -1 // This is how errors are done
00054 
00055 #endif //GLOBAL_H