f
Dependencies: mbed 4DGL-uLCD-SE MMA8452
globals.h@0:8e3b9bb1084a, 2022-03-10 (annotated)
- Committer:
- lballard9
- Date:
- Thu Mar 10 05:18:13 2022 +0000
- Revision:
- 0:8e3b9bb1084a
- Child:
- 5:077b66dfe296
shell rev b;
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 | // |
lballard9 | 0:8e3b9bb1084a | 4 | // Copyright 2020 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 | |
lballard9 | 0:8e3b9bb1084a | 19 | // === [global object] === |
lballard9 | 0:8e3b9bb1084a | 20 | extern uLCD_4DGL uLCD; |
lballard9 | 0:8e3b9bb1084a | 21 | extern Serial pc; // USB Console output |
lballard9 | 0:8e3b9bb1084a | 22 | extern wave_player waver; |
lballard9 | 0:8e3b9bb1084a | 23 | extern PwmOut speaker; |
lballard9 | 0:8e3b9bb1084a | 24 | |
lballard9 | 0:8e3b9bb1084a | 25 | // === [global settings] === |
lballard9 | 0:8e3b9bb1084a | 26 | // === [define the macro of error handle function] === |
lballard9 | 0:8e3b9bb1084a | 27 | // when the condition (c) is not true, assert the program and show error code |
lballard9 | 0:8e3b9bb1084a | 28 | #define ASSERT_P(c,e) do { \ |
lballard9 | 0:8e3b9bb1084a | 29 | if(!(c)){ \ |
lballard9 | 0:8e3b9bb1084a | 30 | uLCD.printf("\nERROR:%d\n",e); \ |
lballard9 | 0:8e3b9bb1084a | 31 | pc.printf("\nERROR:%d\n",e); \ |
lballard9 | 0:8e3b9bb1084a | 32 | while(1); \ |
lballard9 | 0:8e3b9bb1084a | 33 | } \ |
lballard9 | 0:8e3b9bb1084a | 34 | } while (0) |
lballard9 | 0:8e3b9bb1084a | 35 | |
lballard9 | 0:8e3b9bb1084a | 36 | // === [error code] === |
lballard9 | 0:8e3b9bb1084a | 37 | #define ERROR_NONE 0 // All good in the hood |
lballard9 | 0:8e3b9bb1084a | 38 | |
lballard9 | 0:8e3b9bb1084a | 39 | #define ERROR_DLL_INSERT_HEAD -14 // inserting into doubly linked list at head failed |
lballard9 | 0:8e3b9bb1084a | 40 | #define ERROR_DLL_DELETE -15 // deleting node from doubly linked list failed |
lballard9 | 0:8e3b9bb1084a | 41 | // other anti-fruit error code ... |
lballard9 | 0:8e3b9bb1084a | 42 | |
lballard9 | 0:8e3b9bb1084a | 43 | #endif //GLOBAL_H |