Adventure game written for ECE2035 at the Georgia Institute of Technology
Dependencies: mbed wave_player 4DGL-uLCD-SE MMA8452
globals.h@5:93a4c396c1af, 2019-10-26 (annotated)
- Committer:
- trmontgomery
- Date:
- Sat Oct 26 15:44:26 2019 +0000
- Revision:
- 5:93a4c396c1af
- Parent:
- 4:cdc54191ff07
test
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rconnorlawson | 0:35660d7952f7 | 1 | // ============================================ |
rconnorlawson | 0:35660d7952f7 | 2 | // The header file for general project settings |
rconnorlawson | 0:35660d7952f7 | 3 | // Spring 2018 Gatech ECE2035 |
rconnorlawson | 0:35660d7952f7 | 4 | //============================================= |
rconnorlawson | 0:35660d7952f7 | 5 | #ifndef GLOBAL_H |
rconnorlawson | 0:35660d7952f7 | 6 | #define GLOBAL_H |
trmontgomery | 2:0876296d9473 | 7 | #define WIDTH |
trmontgomery | 2:0876296d9473 | 8 | #define HEIGHT |
rconnorlawson | 0:35660d7952f7 | 9 | |
rconnorlawson | 0:35660d7952f7 | 10 | // Include all the hardware libraries |
rconnorlawson | 0:35660d7952f7 | 11 | #include "mbed.h" |
rconnorlawson | 0:35660d7952f7 | 12 | #include "wave_player.h" |
rconnorlawson | 0:35660d7952f7 | 13 | #include "MMA8452.h" |
rconnorlawson | 0:35660d7952f7 | 14 | #include "uLCD_4DGL.h" |
rconnorlawson | 0:35660d7952f7 | 15 | #include "SDFileSystem.h" |
rconnorlawson | 0:35660d7952f7 | 16 | |
trmontgomery | 4:cdc54191ff07 | 17 | |
trmontgomery | 4:cdc54191ff07 | 18 | |
rconnorlawson | 0:35660d7952f7 | 19 | // Declare the hardware interface objects |
rconnorlawson | 0:35660d7952f7 | 20 | extern uLCD_4DGL uLCD; // LCD Screen |
rconnorlawson | 0:35660d7952f7 | 21 | extern SDFileSystem sd; // SD Card |
rconnorlawson | 0:35660d7952f7 | 22 | extern Serial pc; // USB Console output |
rconnorlawson | 0:35660d7952f7 | 23 | extern MMA8452 acc; // Accelerometer |
rconnorlawson | 0:35660d7952f7 | 24 | extern DigitalIn button1; // Pushbuttons |
rconnorlawson | 0:35660d7952f7 | 25 | extern DigitalIn button2; |
rconnorlawson | 0:35660d7952f7 | 26 | extern DigitalIn button3; |
rconnorlawson | 0:35660d7952f7 | 27 | extern AnalogOut DACout; // Speaker |
rconnorlawson | 0:35660d7952f7 | 28 | extern PwmOut speaker; |
rconnorlawson | 0:35660d7952f7 | 29 | extern wave_player waver; |
rconnorlawson | 0:35660d7952f7 | 30 | |
trmontgomery | 4:cdc54191ff07 | 31 | typedef struct{ |
trmontgomery | 4:cdc54191ff07 | 32 | int x,y; // Current locations |
trmontgomery | 4:cdc54191ff07 | 33 | int px, py; // Previous locations |
trmontgomery | 4:cdc54191ff07 | 34 | int has_key; |
trmontgomery | 4:cdc54191ff07 | 35 | int quest_complete; |
trmontgomery | 4:cdc54191ff07 | 36 | int rock_pushed; |
trmontgomery | 4:cdc54191ff07 | 37 | int health; |
trmontgomery | 4:cdc54191ff07 | 38 | int lives; |
trmontgomery | 4:cdc54191ff07 | 39 | int gems; |
trmontgomery | 4:cdc54191ff07 | 40 | }Player; |
trmontgomery | 4:cdc54191ff07 | 41 | |
rconnorlawson | 0:35660d7952f7 | 42 | // === [define the macro of error heandle function] === |
rconnorlawson | 0:35660d7952f7 | 43 | // when the condition (c) is not true, assert the program and show error code |
rconnorlawson | 0:35660d7952f7 | 44 | #define ASSERT_P(c,e) do { \ |
rconnorlawson | 0:35660d7952f7 | 45 | if(!(c)){ \ |
rconnorlawson | 0:35660d7952f7 | 46 | pc.printf("\nERROR:%d\n",e); \ |
rconnorlawson | 0:35660d7952f7 | 47 | while(1); \ |
rconnorlawson | 0:35660d7952f7 | 48 | } \ |
rconnorlawson | 0:35660d7952f7 | 49 | } while (0) |
rconnorlawson | 0:35660d7952f7 | 50 | |
rconnorlawson | 0:35660d7952f7 | 51 | // === [error code] === |
rconnorlawson | 0:35660d7952f7 | 52 | #define ERROR_NONE 0 // All good in the hood |
rconnorlawson | 0:35660d7952f7 | 53 | #define ERROR_MEH -1 // This is how errors are done |
rconnorlawson | 0:35660d7952f7 | 54 | |
rconnorlawson | 0:35660d7952f7 | 55 | #endif //GLOBAL_H |