Ben Gordon
/
ELEC351_GroupA_alternate
temp
Pages.cpp@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 | #include "Pages.hpp" |
BenRJG | 0:2a4af0cb6e8d | 2 | |
BenRJG | 0:2a4af0cb6e8d | 3 | //d.setTime(); |
BenRJG | 0:2a4af0cb6e8d | 4 | //printf("Info Start -------\n\r"); |
BenRJG | 0:2a4af0cb6e8d | 5 | //printf("Time -> %s\n\r",d.getTime()); |
BenRJG | 0:2a4af0cb6e8d | 6 | //printf("Info End ---------\n\r"); |
BenRJG | 0:2a4af0cb6e8d | 7 | |
BenRJG | 0:2a4af0cb6e8d | 8 | void Pages::INIT() |
BenRJG | 0:2a4af0cb6e8d | 9 | { |
BenRJG | 0:2a4af0cb6e8d | 10 | setTemperature(0); |
BenRJG | 0:2a4af0cb6e8d | 11 | setLightLevel(0); |
BenRJG | 0:2a4af0cb6e8d | 12 | setPressure(0); |
BenRJG | 0:2a4af0cb6e8d | 13 | _lcd.INIT(); |
BenRJG | 0:2a4af0cb6e8d | 14 | |
BenRJG | 0:2a4af0cb6e8d | 15 | } |
BenRJG | 0:2a4af0cb6e8d | 16 | |
BenRJG | 0:2a4af0cb6e8d | 17 | void Pages::pageOne() |
BenRJG | 0:2a4af0cb6e8d | 18 | { |
BenRJG | 0:2a4af0cb6e8d | 19 | _lcd.clear(); |
BenRJG | 0:2a4af0cb6e8d | 20 | // _lcd.disableCursor(); |
BenRJG | 0:2a4af0cb6e8d | 21 | |
BenRJG | 0:2a4af0cb6e8d | 22 | //Temperature Page |
BenRJG | 0:2a4af0cb6e8d | 23 | _lcd.display("T: ",LINE1); |
BenRJG | 0:2a4af0cb6e8d | 24 | _lcd.display(_temperature); |
BenRJG | 0:2a4af0cb6e8d | 25 | _lcd.putt(223); |
BenRJG | 0:2a4af0cb6e8d | 26 | _lcd.display("C"); |
BenRJG | 0:2a4af0cb6e8d | 27 | |
BenRJG | 0:2a4af0cb6e8d | 28 | //LightLevel Page |
BenRJG | 0:2a4af0cb6e8d | 29 | _lcd.display("L: ",LINE1+9); |
BenRJG | 0:2a4af0cb6e8d | 30 | _lcd.display(_lightLevel); |
BenRJG | 0:2a4af0cb6e8d | 31 | |
BenRJG | 0:2a4af0cb6e8d | 32 | //Pressure Page |
BenRJG | 0:2a4af0cb6e8d | 33 | _lcd.display("P: ",LINE2+2); |
BenRJG | 0:2a4af0cb6e8d | 34 | _lcd.display(_pressure); |
BenRJG | 0:2a4af0cb6e8d | 35 | _lcd.display(" mbar"); |
BenRJG | 0:2a4af0cb6e8d | 36 | _lcd.enableCursor(); |
BenRJG | 0:2a4af0cb6e8d | 37 | } |
BenRJG | 0:2a4af0cb6e8d | 38 | |
BenRJG | 0:2a4af0cb6e8d | 39 | void Pages::pageTwo() |
BenRJG | 0:2a4af0cb6e8d | 40 | { |
BenRJG | 0:2a4af0cb6e8d | 41 | _lcd.clear(); |
BenRJG | 0:2a4af0cb6e8d | 42 | // _lcd.enableCursor(); |
BenRJG | 0:2a4af0cb6e8d | 43 | |
BenRJG | 0:2a4af0cb6e8d | 44 | _lcd.display("00/00/0000 00:00",LINE1); |
BenRJG | 0:2a4af0cb6e8d | 45 | _lcd.display("dd/mm/yyyy hh:mm",LINE2); |
BenRJG | 0:2a4af0cb6e8d | 46 | |
BenRJG | 0:2a4af0cb6e8d | 47 | _lcd.pos(LINE1); |
BenRJG | 0:2a4af0cb6e8d | 48 | } |
BenRJG | 0:2a4af0cb6e8d | 49 | |
BenRJG | 0:2a4af0cb6e8d | 50 | void Pages::pageThree() |
BenRJG | 0:2a4af0cb6e8d | 51 | { |
BenRJG | 0:2a4af0cb6e8d | 52 | _lcd.clear(); |
BenRJG | 0:2a4af0cb6e8d | 53 | // _lcd.enableCursor(); |
BenRJG | 0:2a4af0cb6e8d | 54 | |
BenRJG | 0:2a4af0cb6e8d | 55 | _lcd.display("Life? don't talk",LINE1); |
BenRJG | 0:2a4af0cb6e8d | 56 | _lcd.display("to me about life",LINE2); |
BenRJG | 0:2a4af0cb6e8d | 57 | |
BenRJG | 0:2a4af0cb6e8d | 58 | _lcd.pos(LINE1); |
BenRJG | 0:2a4af0cb6e8d | 59 | } |
BenRJG | 0:2a4af0cb6e8d | 60 | |
BenRJG | 0:2a4af0cb6e8d | 61 | void Pages::setTemperature(S_BYTE temp) |
BenRJG | 0:2a4af0cb6e8d | 62 | { |
BenRJG | 0:2a4af0cb6e8d | 63 | sprintf(_temperature,"%d",temp); |
BenRJG | 0:2a4af0cb6e8d | 64 | } |
BenRJG | 0:2a4af0cb6e8d | 65 | |
BenRJG | 0:2a4af0cb6e8d | 66 | void Pages::setLightLevel(U_BYTE light) |
BenRJG | 0:2a4af0cb6e8d | 67 | { |
BenRJG | 0:2a4af0cb6e8d | 68 | sprintf(_lightLevel,"%u",light); |
BenRJG | 0:2a4af0cb6e8d | 69 | } |
BenRJG | 0:2a4af0cb6e8d | 70 | |
BenRJG | 0:2a4af0cb6e8d | 71 | void Pages::setPressure(U_BYTE pres) |
BenRJG | 0:2a4af0cb6e8d | 72 | { |
BenRJG | 0:2a4af0cb6e8d | 73 | sprintf(_pressure,"%u",pres); |
BenRJG | 0:2a4af0cb6e8d | 74 | } |
BenRJG | 0:2a4af0cb6e8d | 75 | |
BenRJG | 0:2a4af0cb6e8d | 76 | void Pages::setDateTime(char* dateTime) |
BenRJG | 0:2a4af0cb6e8d | 77 | { |
BenRJG | 0:2a4af0cb6e8d | 78 | _lcd.pos(LINE1); |
BenRJG | 0:2a4af0cb6e8d | 79 | _lcd.display(dateTime,LINE1); |
BenRJG | 0:2a4af0cb6e8d | 80 | } |
BenRJG | 0:2a4af0cb6e8d | 81 | |
BenRJG | 0:2a4af0cb6e8d | 82 | void Pages::cursorPos(UINT_16 location) |
BenRJG | 0:2a4af0cb6e8d | 83 | { |
BenRJG | 0:2a4af0cb6e8d | 84 | _lcd.pos(location); |
BenRJG | 0:2a4af0cb6e8d | 85 | } |
BenRJG | 0:2a4af0cb6e8d | 86 | |
BenRJG | 0:2a4af0cb6e8d | 87 | void Pages::clear() |
BenRJG | 0:2a4af0cb6e8d | 88 | { |
BenRJG | 0:2a4af0cb6e8d | 89 | |
BenRJG | 0:2a4af0cb6e8d | 90 | } |
BenRJG | 0:2a4af0cb6e8d | 91 |