Contains the main execution of the clock uses headers to import functions

Dependencies:   RTC-DS1307 SPI_TFT_ILI9341 TFT_fonts mbed tsi_sensor

Fork of TFT_Mikroelectronika_IL9341_sketchpad by Oxford CWM Team

Committer:
Owenmatthewmcgowan
Date:
Fri May 26 09:37:06 2017 +0000
Revision:
49:243b5e826228
Parent:
48:76ac309a2bd9
Parent:
47:731431234bd0
merge;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Owenmatthewmcgowan 32:56f59b79720c 1 bool f_alarm = false, f_alarm_sound=false;
Owenmatthewmcgowan 19:4c30c3182e04 2 int f_state;
mlin 40:05798eeadd02 3 bool f_cycle = false;
Owenmatthewmcgowan 48:76ac309a2bd9 4 int f_cycle_secs = 0;
Owenmatthewmcgowan 48:76ac309a2bd9 5 int f_cycle_wait = 5;
mlin 9:eee503060d69 6 #include "libs.h"
Owenmatthewmcgowan 12:50289d0ac834 7 //DigitalOut led(LED1);
Owenmatthewmcgowan 19:4c30c3182e04 8
Owenmatthewmcgowan 12:50289d0ac834 9 //DigitalIn sw_w(SW3);
cstevens 6:18c7288b5e00 10
mlin 9:eee503060d69 11 void main()
dreschpe 0:7c3b9bfd6ead 12 {
Owenmatthewmcgowan 19:4c30c3182e04 13 while(!rtc.startClock()){}
dreschpe 0:7c3b9bfd6ead 14 TFT.claim(stdout); // send stdout to the TFT display
dreschpe 0:7c3b9bfd6ead 15 TFT.set_orientation(1);
dreschpe 0:7c3b9bfd6ead 16 TFT.background(Black); // set background to black
dreschpe 0:7c3b9bfd6ead 17 TFT.foreground(White); // set chars to white
mlin 11:1da15361a35b 18 TFT.cls();
mlin 11:1da15361a35b 19 // pc.baud(115200);
Owenmatthewmcgowan 19:4c30c3182e04 20 f_state = 1;
Owenmatthewmcgowan 19:4c30c3182e04 21 f_alarm = false;
Owenmatthewmcgowan 19:4c30c3182e04 22 runclock();
Owenmatthewmcgowan 48:76ac309a2bd9 23 int looplimit = 20 , loopcount = 0;
mlin 10:9d9b3b9b28b8 24 while (true) {
Owenmatthewmcgowan 48:76ac309a2bd9 25
Owenmatthewmcgowan 29:684e2a3e17b5 26 switch (f_state){
Owenmatthewmcgowan 48:76ac309a2bd9 27 case (1): runclock(); break;// if(f_cycle){loopcount = (loopcount + 1) % (looplimit + 1); if (loopcount == looplimit) {f_state = 2; TFT.cls();} }break;
Owenmatthewmcgowan 48:76ac309a2bd9 28 case (3): settings();
Owenmatthewmcgowan 48:76ac309a2bd9 29 case (2): runanaclock(); break;// if(f_cycle){loopcount = (loopcount + 1) % (looplimit + 1); if (loopcount == looplimit) {f_state = 1; TFT.cls();} }break;
Owenmatthewmcgowan 29:684e2a3e17b5 30 case (4): whiteboard(); f_state = 1; break;
Owenmatthewmcgowan 48:76ac309a2bd9 31 //case (5): pong(); break; // pong removed - too slow
Owenmatthewmcgowan 49:243b5e826228 32
Owenmatthewmcgowan 29:684e2a3e17b5 33 }
Owenmatthewmcgowan 19:4c30c3182e04 34 }
mlin 16:3cb9b1fbc039 35
mlin 16:3cb9b1fbc039 36
Owenmatthewmcgowan 19:4c30c3182e04 37 //draw_state(4);
mlin 11:1da15361a35b 38
mlin 11:1da15361a35b 39
mlin 11:1da15361a35b 40
cstevens 6:18c7288b5e00 41
dreschpe 0:7c3b9bfd6ead 42 }