Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed wave_player 4DGL-uLCD-SE MMA8452
globals.h@1:5724f2947554, 2021-05-11 (annotated)
- Committer:
- lwills
- Date:
- Tue May 11 18:26:14 2021 +0000
- Revision:
- 1:5724f2947554
- Parent:
- 0:09aa1ecd6c39
Updated comments
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lwills | 0:09aa1ecd6c39 | 1 | //================================================================= |
lwills | 0:09aa1ecd6c39 | 2 | // The header file for general settings for the project |
lwills | 0:09aa1ecd6c39 | 3 | // |
lwills | 1:5724f2947554 | 4 | // Copyright 2021 Georgia Tech. All rights reserved. |
lwills | 0:09aa1ecd6c39 | 5 | // The materials provided by the instructor in this course are for |
lwills | 0:09aa1ecd6c39 | 6 | // the use of the students currently enrolled in the course. |
lwills | 0:09aa1ecd6c39 | 7 | // Copyrighted course materials may not be further disseminated. |
lwills | 0:09aa1ecd6c39 | 8 | // This file must not be made publicly available anywhere. |
lwills | 0:09aa1ecd6c39 | 9 | //================================================================= |
lwills | 0:09aa1ecd6c39 | 10 | |
lwills | 0:09aa1ecd6c39 | 11 | #ifndef GLOBAL_H |
lwills | 0:09aa1ecd6c39 | 12 | #define GLOBAL_H |
lwills | 0:09aa1ecd6c39 | 13 | #include "mbed.h" |
lwills | 0:09aa1ecd6c39 | 14 | #include "wave_player.h" |
lwills | 0:09aa1ecd6c39 | 15 | #include "uLCD_4DGL.h" |
lwills | 0:09aa1ecd6c39 | 16 | #include "MMA8452.h" |
lwills | 0:09aa1ecd6c39 | 17 | |
lwills | 0:09aa1ecd6c39 | 18 | // === [global object] === |
lwills | 0:09aa1ecd6c39 | 19 | extern uLCD_4DGL uLCD; |
lwills | 0:09aa1ecd6c39 | 20 | extern Serial pc; // USB Console output |
lwills | 0:09aa1ecd6c39 | 21 | extern wave_player waver; |
lwills | 0:09aa1ecd6c39 | 22 | extern PwmOut speaker; |
lwills | 0:09aa1ecd6c39 | 23 | |
lwills | 0:09aa1ecd6c39 | 24 | // === [global settings] === |
lwills | 0:09aa1ecd6c39 | 25 | #define BACKGROUND_COLOR 0x000000 //black |
lwills | 0:09aa1ecd6c39 | 26 | #define LANDSCAPE_HEIGHT 4 // number of pixel on the screen |
lwills | 0:09aa1ecd6c39 | 27 | #define MAX_BUILDING_HEIGHT 10 // number of pixel on the screen |
lwills | 0:09aa1ecd6c39 | 28 | |
lwills | 0:09aa1ecd6c39 | 29 | |
lwills | 0:09aa1ecd6c39 | 30 | // === [define the macro of error handle function] === |
lwills | 0:09aa1ecd6c39 | 31 | // when the condition (c) is not true, assert the program and show error code |
lwills | 0:09aa1ecd6c39 | 32 | #define ASSERT_P(c,e) do { \ |
lwills | 0:09aa1ecd6c39 | 33 | if(!(c)){ \ |
lwills | 0:09aa1ecd6c39 | 34 | uLCD.printf("\nERROR:%d\n",e); \ |
lwills | 0:09aa1ecd6c39 | 35 | pc.printf("\nERROR:%d\n",e); \ |
lwills | 0:09aa1ecd6c39 | 36 | while(1); \ |
lwills | 0:09aa1ecd6c39 | 37 | } \ |
lwills | 0:09aa1ecd6c39 | 38 | } while (0) |
lwills | 0:09aa1ecd6c39 | 39 | |
lwills | 0:09aa1ecd6c39 | 40 | // === [error code] === |
lwills | 0:09aa1ecd6c39 | 41 | #define ERROR_NONE 0 // All good in the hood |
lwills | 0:09aa1ecd6c39 | 42 | #define ERROR_MISSILE_INDEX_GET_INFO -1 // make sure your code gives the valid index for missile_get_info() |
lwills | 0:09aa1ecd6c39 | 43 | #define ERROR_MISSILE_INDEX_UPDATE_STATUS -2 // make sure your code gives the valid index for missile_update_status() |
lwills | 0:09aa1ecd6c39 | 44 | #define ERROR_MISSILE_SPEED -3 // missile speed has to be between 1 and 8 |
lwills | 0:09aa1ecd6c39 | 45 | #define ERROR_MISSILE_INTERVAL -4 // missile interval has to be between 1 and 100 |
lwills | 0:09aa1ecd6c39 | 46 | // other missile error code ... |
lwills | 0:09aa1ecd6c39 | 47 | #define ERROR_CITY_NUMBER -11 // num_city in city_landscape_init() is larger than MAX_NUM_CITY |
lwills | 0:09aa1ecd6c39 | 48 | #define ERROR_CITY_INDEX_GET_INFO -12 // make sure your code gives the valid index for city_get_info() |
lwills | 0:09aa1ecd6c39 | 49 | #define ERROR_CITY_INDEX_DEMOLISH -13 // make sure your code gives the valid index for city_demolish() |
lwills | 0:09aa1ecd6c39 | 50 | // DLL |
lwills | 0:09aa1ecd6c39 | 51 | #define ERROR_DLL_INSERT_HEAD -14 // inserting into doubly linked list at head failed |
lwills | 0:09aa1ecd6c39 | 52 | #define ERROR_DLL_DELETE -15 // deleting node from doubly linked list failed |
lwills | 0:09aa1ecd6c39 | 53 | // other anti-missile error code ... |
lwills | 0:09aa1ecd6c39 | 54 | |
lwills | 0:09aa1ecd6c39 | 55 | #endif //GLOBAL_H |