Tamas Titusz Ban
/
ELEC1620_ExamTemplate_2019
Template for the ELEC1620 End of year exam
TestAdmin/TestAdmin.cpp@0:54721f063ac8, 2019-03-22 (annotated)
- Committer:
- el16ttb
- Date:
- Fri Mar 22 13:11:07 2019 +0000
- Revision:
- 0:54721f063ac8
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el16ttb | 0:54721f063ac8 | 1 | #include "TestAdmin.h" |
el16ttb | 0:54721f063ac8 | 2 | |
el16ttb | 0:54721f063ac8 | 3 | DigitalIn* TestAdmin::_skipButton = new DigitalIn(p26); |
el16ttb | 0:54721f063ac8 | 4 | const char* TestAdmin::_str = ""; |
el16ttb | 0:54721f063ac8 | 5 | N5110* TestAdmin::_lcd; |
el16ttb | 0:54721f063ac8 | 6 | StreamOut* TestAdmin::_streamOut; |
el16ttb | 0:54721f063ac8 | 7 | bool TestAdmin::printEnabled = false; |
el16ttb | 0:54721f063ac8 | 8 | |
el16ttb | 0:54721f063ac8 | 9 | void TestAdmin::setTaskName(const char *s, N5110 *lcd, StreamOut *streamout){ |
el16ttb | 0:54721f063ac8 | 10 | TestAdmin::_str = s; |
el16ttb | 0:54721f063ac8 | 11 | TestAdmin::_lcd = lcd; |
el16ttb | 0:54721f063ac8 | 12 | TestAdmin::_streamOut = streamout; |
el16ttb | 0:54721f063ac8 | 13 | } |
el16ttb | 0:54721f063ac8 | 14 | |
el16ttb | 0:54721f063ac8 | 15 | bool TestAdmin::testRunning(){ |
el16ttb | 0:54721f063ac8 | 16 | #ifndef DISABLE_WAIT |
el16ttb | 0:54721f063ac8 | 17 | // wait(0.2); |
el16ttb | 0:54721f063ac8 | 18 | #endif |
el16ttb | 0:54721f063ac8 | 19 | if(printEnabled){ |
el16ttb | 0:54721f063ac8 | 20 | _streamOut->lock(); |
el16ttb | 0:54721f063ac8 | 21 | _lcd->clear(); |
el16ttb | 0:54721f063ac8 | 22 | _lcd->printString(_str, 24, 1); |
el16ttb | 0:54721f063ac8 | 23 | _lcd->printString("Cycle between", 3, 3); |
el16ttb | 0:54721f063ac8 | 24 | _lcd->printString(" tasks by", 0, 4); |
el16ttb | 0:54721f063ac8 | 25 | _lcd->printString(" pressing D", 0, 5); |
el16ttb | 0:54721f063ac8 | 26 | _lcd->refresh(); |
el16ttb | 0:54721f063ac8 | 27 | _streamOut->unlock(); |
el16ttb | 0:54721f063ac8 | 28 | } |
el16ttb | 0:54721f063ac8 | 29 | |
el16ttb | 0:54721f063ac8 | 30 | return !*_skipButton; |
el16ttb | 0:54721f063ac8 | 31 | } |
el16ttb | 0:54721f063ac8 | 32 |