project for 2035
Dependencies: mbed wave_player 4DGL-uLCD-SE MMA8452
globals.h@1:10330bce85cb, 2020-10-23 (annotated)
- Committer:
- DCchico
- Date:
- Fri Oct 23 16:18:39 2020 -0400
- Revision:
- 1:10330bce85cb
- Child:
- 2:4947d6a82971
shell-code
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
DCchico | 1:10330bce85cb | 1 | // ============================================ |
DCchico | 1:10330bce85cb | 2 | // The header file for general project settings |
DCchico | 1:10330bce85cb | 3 | // Spring 2018 Gatech ECE2035 |
DCchico | 1:10330bce85cb | 4 | //============================================= |
DCchico | 1:10330bce85cb | 5 | #ifndef GLOBAL_H |
DCchico | 1:10330bce85cb | 6 | #define GLOBAL_H |
DCchico | 1:10330bce85cb | 7 | |
DCchico | 1:10330bce85cb | 8 | // Include all the hardware libraries |
DCchico | 1:10330bce85cb | 9 | #include "mbed.h" |
DCchico | 1:10330bce85cb | 10 | #include "wave_player.h" |
DCchico | 1:10330bce85cb | 11 | #include "MMA8452.h" |
DCchico | 1:10330bce85cb | 12 | #include "uLCD_4DGL.h" |
DCchico | 1:10330bce85cb | 13 | #include "SDFileSystem.h" |
DCchico | 1:10330bce85cb | 14 | |
DCchico | 1:10330bce85cb | 15 | // Declare the hardware interface objects |
DCchico | 1:10330bce85cb | 16 | extern uLCD_4DGL uLCD; // LCD Screen |
DCchico | 1:10330bce85cb | 17 | extern SDFileSystem sd; // SD Card |
DCchico | 1:10330bce85cb | 18 | extern Serial pc; // USB Console output |
DCchico | 1:10330bce85cb | 19 | extern MMA8452 acc; // Accelerometer |
DCchico | 1:10330bce85cb | 20 | extern DigitalIn button1; // Pushbuttons |
DCchico | 1:10330bce85cb | 21 | extern DigitalIn button2; |
DCchico | 1:10330bce85cb | 22 | extern DigitalIn button3; |
DCchico | 1:10330bce85cb | 23 | extern AnalogOut DACout; // Speaker |
DCchico | 1:10330bce85cb | 24 | extern PwmOut speaker; |
DCchico | 1:10330bce85cb | 25 | extern wave_player waver; |
DCchico | 1:10330bce85cb | 26 | |
DCchico | 1:10330bce85cb | 27 | |
DCchico | 1:10330bce85cb | 28 | // Global settings |
DCchico | 1:10330bce85cb | 29 | #define BACKGROUND_COLOR 0x000000 //black |
DCchico | 1:10330bce85cb | 30 | #define LANDSCAPE_HEIGHT 4 // number of pixel on the screen |
DCchico | 1:10330bce85cb | 31 | #define MAX_BUILDING_HEIGHT 10 // number of pixel on the screen |
DCchico | 1:10330bce85cb | 32 | |
DCchico | 1:10330bce85cb | 33 | |
DCchico | 1:10330bce85cb | 34 | // === [define the macro of error heandle function] === |
DCchico | 1:10330bce85cb | 35 | // when the condition (c) is not true, assert the program and show error code |
DCchico | 1:10330bce85cb | 36 | #define ASSERT_P(c,e) do { \ |
DCchico | 1:10330bce85cb | 37 | if(!(c)){ \ |
DCchico | 1:10330bce85cb | 38 | pc.printf("\nERROR:%d\n",e); \ |
DCchico | 1:10330bce85cb | 39 | while(1); \ |
DCchico | 1:10330bce85cb | 40 | } \ |
DCchico | 1:10330bce85cb | 41 | } while (0) |
DCchico | 1:10330bce85cb | 42 | |
DCchico | 1:10330bce85cb | 43 | // === [error code] === |
DCchico | 1:10330bce85cb | 44 | #define ERROR_NONE 0 // All good in the hood |
DCchico | 1:10330bce85cb | 45 | #define ERROR_MEH -1 // This is how errors are done |
DCchico | 1:10330bce85cb | 46 | |
DCchico | 1:10330bce85cb | 47 | #endif //GLOBAL_H |