Ben Gordon
/
ELEC351_GroupA_alternate
temp
Terminal.hpp@0:2a4af0cb6e8d, 2018-12-06 (annotated)
- Committer:
- BenRJG
- Date:
- Thu Dec 06 15:38:09 2018 +0000
- Revision:
- 0:2a4af0cb6e8d
Imported Code from Kiel; Added button functionality; Added set DateTime Functionality
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
BenRJG | 0:2a4af0cb6e8d | 1 | /******************************************************************************* |
BenRJG | 0:2a4af0cb6e8d | 2 | This header defines Terminal class which has all the functions for controlling a |
BenRJG | 0:2a4af0cb6e8d | 3 | terminal, the serial object is kept private and therefore can only be accessed |
BenRJG | 0:2a4af0cb6e8d | 4 | through function of the terminal class. |
BenRJG | 0:2a4af0cb6e8d | 5 | *******************************************************************************/ |
BenRJG | 0:2a4af0cb6e8d | 6 | |
BenRJG | 0:2a4af0cb6e8d | 7 | #include "mbed.h" |
BenRJG | 0:2a4af0cb6e8d | 8 | #include "rtos.h" |
BenRJG | 0:2a4af0cb6e8d | 9 | #include "General.hpp" |
BenRJG | 0:2a4af0cb6e8d | 10 | |
BenRJG | 0:2a4af0cb6e8d | 11 | // Use generic to set number of rows in table |
BenRJG | 0:2a4af0cb6e8d | 12 | #define Rows 15 |
BenRJG | 0:2a4af0cb6e8d | 13 | #define MaxDATA (Rows*4) |
BenRJG | 0:2a4af0cb6e8d | 14 | |
BenRJG | 0:2a4af0cb6e8d | 15 | // Define 8 bit colours for printing to terminal |
BenRJG | 0:2a4af0cb6e8d | 16 | #define ColourRED 9 |
BenRJG | 0:2a4af0cb6e8d | 17 | #define ColourGREEN 118 |
BenRJG | 0:2a4af0cb6e8d | 18 | #define ColourBLUE 12 |
BenRJG | 0:2a4af0cb6e8d | 19 | #define ColourWhite 255 |
BenRJG | 0:2a4af0cb6e8d | 20 | #define ColourPurple 5 |
BenRJG | 0:2a4af0cb6e8d | 21 | |
BenRJG | 0:2a4af0cb6e8d | 22 | // Class Terminal expects tx and rx pins and is used for controlling a serialy conected terminal |
BenRJG | 0:2a4af0cb6e8d | 23 | class Terminal { |
BenRJG | 0:2a4af0cb6e8d | 24 | public: |
BenRJG | 0:2a4af0cb6e8d | 25 | Terminal(PinName tx, PinName rx) : pc(tx, rx){} |
BenRJG | 0:2a4af0cb6e8d | 26 | void init(void); |
BenRJG | 0:2a4af0cb6e8d | 27 | void PrintDATA(BYTE* STRING, BYTE IDX); |
BenRJG | 0:2a4af0cb6e8d | 28 | void PrintMSGS(BYTE* STRING); |
BenRJG | 0:2a4af0cb6e8d | 29 | void DisplayCellIndex(void); // Prints index of cells into each cell for debug purpose |
BenRJG | 0:2a4af0cb6e8d | 30 | private: |
BenRJG | 0:2a4af0cb6e8d | 31 | Serial pc; |
BenRJG | 0:2a4af0cb6e8d | 32 | void Cursor(BYTE X, BYTE Y); // Function moves cursor to position defined by co-ordinates x,y |
BenRJG | 0:2a4af0cb6e8d | 33 | void Colour(BYTE COLOUR); // Function changes terminal print colour to 8 bit colour defined by COLOUR |
BenRJG | 0:2a4af0cb6e8d | 34 | }; |
BenRJG | 0:2a4af0cb6e8d | 35 | |
BenRJG | 0:2a4af0cb6e8d | 36 | void TerminalThread(void); // Thread for terminal to run in |
BenRJG | 0:2a4af0cb6e8d | 37 |