Nasir Christian / Mbed 2 deprecated rpg_game_shell_FA21_Nasir

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 
00008 // Include all the hardware libraries
00009 #include "mbed.h"
00010 #include "wave_player.h"
00011 #include "MMA8452.h"
00012 #include "uLCD_4DGL.h"
00013 #include "SDFileSystem.h"
00014 
00015 // Declare the hardware interface objects
00016 /*
00017 This file holds all the global variables that are accessable from all the 
00018 different files in this project. You see below most of it looks like hardware.
00019 That's because it is hardware! The uLCD object is how you interact with the LCD
00020 screen. The sd variable is how you interact with the sd card and so on for all
00021 the other variables.
00022 */
00023 extern uLCD_4DGL uLCD;      // LCD Screen
00024 extern SDFileSystem sd;     // SD Card
00025 extern Serial pc;           // USB Console output
00026 extern MMA8452 acc;       // Accelerometer
00027 extern DigitalIn button1;   // Pushbuttons
00028 extern DigitalIn button2;
00029 extern DigitalIn button3;
00030 extern AnalogOut DACout;    // Speaker
00031 extern PwmOut speaker;
00032 extern wave_player waver;
00033 
00034 // === [define the macro of error heandle function] ===
00035 // when the condition (c) is not true, assert the program and show error code
00036 #define ASSERT_P(c,e) do { \
00037     if(!(c)){ \
00038         pc.printf("\nERROR:%d\n",e); \
00039         while(1); \
00040     } \
00041 } while (0)
00042 
00043 // === [error code] ===
00044 #define ERROR_NONE 0 // All good in the hood
00045 #define ERROR_MEH -1 // This is how errors are done
00046 
00047 #endif //GLOBAL_H