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
merge;

Who changed what in which revision?

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