f
Dependencies: mbed 4DGL-uLCD-SE MMA8452
globals.h@6:453dc852ac0f, 2022-04-12 (annotated)
- Committer:
- dfrausto3
- Date:
- Tue Apr 12 01:39:20 2022 +0000
- Revision:
- 6:453dc852ac0f
- Parent:
- 5:077b66dfe296
f
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lballard9 | 0:8e3b9bb1084a | 1 | //================================================================= |
lballard9 | 0:8e3b9bb1084a | 2 | // The header file for general settings for the project |
lballard9 | 0:8e3b9bb1084a | 3 | // |
lwills | 5:077b66dfe296 | 4 | // Copyright 2022 Georgia Tech. All rights reserved. |
lballard9 | 0:8e3b9bb1084a | 5 | // The materials provided by the instructor in this course are for |
lballard9 | 0:8e3b9bb1084a | 6 | // the use of the students currently enrolled in the course. |
lballard9 | 0:8e3b9bb1084a | 7 | // Copyrighted course materials may not be further disseminated. |
lballard9 | 0:8e3b9bb1084a | 8 | // This file must not be made publicly available anywhere. |
lballard9 | 0:8e3b9bb1084a | 9 | //================================================================= |
lballard9 | 0:8e3b9bb1084a | 10 | |
lballard9 | 0:8e3b9bb1084a | 11 | #ifndef GLOBAL_H |
lballard9 | 0:8e3b9bb1084a | 12 | #define GLOBAL_H |
lballard9 | 0:8e3b9bb1084a | 13 | #include "mbed.h" |
lballard9 | 0:8e3b9bb1084a | 14 | #include "wave_player.h" |
lballard9 | 0:8e3b9bb1084a | 15 | #include "uLCD_4DGL.h" |
lballard9 | 0:8e3b9bb1084a | 16 | #include "MMA8452.h" |
lballard9 | 0:8e3b9bb1084a | 17 | #include <math.h> |
lballard9 | 0:8e3b9bb1084a | 18 | |
lwills | 5:077b66dfe296 | 19 | /* |
lwills | 5:077b66dfe296 | 20 | This file holds all the global variables that are accessable from all the |
lwills | 5:077b66dfe296 | 21 | different files in this project. You see below most of it looks like hardware. |
lwills | 5:077b66dfe296 | 22 | That's because it is hardware! The uLCD object is how you interact with the LCD |
lwills | 5:077b66dfe296 | 23 | screen. The sd variable is how you interact with the sd card and so on for all |
lwills | 5:077b66dfe296 | 24 | the other variables. |
lwills | 5:077b66dfe296 | 25 | */ |
lwills | 5:077b66dfe296 | 26 | extern uLCD_4DGL uLCD; // LCD Screen |
lballard9 | 0:8e3b9bb1084a | 27 | extern Serial pc; // USB Console output |
lwills | 5:077b66dfe296 | 28 | extern MMA8452 acc; // Accelerometer |
lwills | 5:077b66dfe296 | 29 | extern DigitalIn button1; // Pushbuttons |
lwills | 5:077b66dfe296 | 30 | extern DigitalIn button2; |
lwills | 5:077b66dfe296 | 31 | extern DigitalIn button3; |
lwills | 5:077b66dfe296 | 32 | extern AnalogOut DACout; // Speaker |
lwills | 5:077b66dfe296 | 33 | extern PwmOut speaker; |
lballard9 | 0:8e3b9bb1084a | 34 | extern wave_player waver; |
lballard9 | 0:8e3b9bb1084a | 35 | |
lballard9 | 0:8e3b9bb1084a | 36 | // === [global settings] === |
lballard9 | 0:8e3b9bb1084a | 37 | // === [define the macro of error handle function] === |
lballard9 | 0:8e3b9bb1084a | 38 | // when the condition (c) is not true, assert the program and show error code |
lballard9 | 0:8e3b9bb1084a | 39 | #define ASSERT_P(c,e) do { \ |
lballard9 | 0:8e3b9bb1084a | 40 | if(!(c)){ \ |
lballard9 | 0:8e3b9bb1084a | 41 | uLCD.printf("\nERROR:%d\n",e); \ |
lballard9 | 0:8e3b9bb1084a | 42 | pc.printf("\nERROR:%d\n",e); \ |
lballard9 | 0:8e3b9bb1084a | 43 | while(1); \ |
lballard9 | 0:8e3b9bb1084a | 44 | } \ |
lballard9 | 0:8e3b9bb1084a | 45 | } while (0) |
lballard9 | 0:8e3b9bb1084a | 46 | |
lballard9 | 0:8e3b9bb1084a | 47 | // === [error code] === |
lballard9 | 0:8e3b9bb1084a | 48 | #define ERROR_NONE 0 // All good in the hood |
lballard9 | 0:8e3b9bb1084a | 49 | |
lballard9 | 0:8e3b9bb1084a | 50 | #define ERROR_DLL_INSERT_HEAD -14 // inserting into doubly linked list at head failed |
lballard9 | 0:8e3b9bb1084a | 51 | #define ERROR_DLL_DELETE -15 // deleting node from doubly linked list failed |
lwills | 5:077b66dfe296 | 52 | // add other error codes ... |
lballard9 | 0:8e3b9bb1084a | 53 | |
lballard9 | 0:8e3b9bb1084a | 54 | #endif //GLOBAL_H |