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

Files at this revision

API Documentation at this revision

Comitter:
mlin
Date:
Thu May 25 10:13:13 2017 +0000
Parent:
16:3cb9b1fbc039
Child:
18:02667782b06f
Commit message:
time page working ;

Changed in this revision

clocklogic.h Show annotated file Show diff for this revision Revisions of this file
drawStates.h Show annotated file Show diff for this revision Revisions of this file
--- a/clocklogic.h	Thu May 25 09:48:31 2017 +0000
+++ b/clocklogic.h	Thu May 25 10:13:13 2017 +0000
@@ -21,15 +21,16 @@
         {
             //set desired state to 4
             return 4;
-        }button home
+        }else if (x > 0 && x < 50 && y > 200 && y < 240) // button home
         {
             //set desired state to 0
             return 0;
         }
-        else if (x > 140 && x < 230 && y > ?? && y < ??) // alarm button on or off
+        else if (x > 140 && x < 230 && y >  100 && y < 200) // alarm button on or off
         {
             //set desired state to 5
-            return 5;
+            f_alarm = !(f_alarm);
+            return -1;
         }
     }
     return -1;
@@ -42,5 +43,44 @@
 {
     draw_state(1);
     while (f_state == 1){
-        tm_c = tm_c.getTime()
-        if state 
\ No newline at end of file
+        read_time()
+        TFT.set_font((unsigned char*) Arial24x23); //set alarm hour
+        TFT.locate(70,40);
+        TFT.printf("%d",tm_c.hour);
+        TFT.locate(160,40);
+        TFT.printf("%d",tm_c.min);
+        TFT.locate(250,40);
+        TFT.printf("%d",tm_c.sec);
+        TFT.locate(60,140);
+        TFT.set_font((unsigned char*) Arial12x12);
+        TFT.printf("%s",rtc.weekdayToString(tm_c.wday));
+        TFT.set_font((unsigned char*) Arial24x23);
+        if (f_alarm) {
+        TFT.locate(160,140);
+        TFT.printf("%d",tm_a_hr);
+        TFT.locate(250,40);    
+        TFT.printf("%d",tm_a_min);    
+        }
+        else
+        {
+            TFT.locate(160,140);
+            TFT.printf("   ");
+           TFT.locate(250,40);    
+           TFT.printf("   ");   
+        }
+        TFT.locate(210,70);
+        TFT.printf("%s",tm_c.date);
+        TFT.locate(250,160);    
+        TFT.printf("%d",tm_c.mon);    
+        TFT.locate(250,250);    
+        TFT.printf("%d",tm_c.year);    
+        }
+        switch (digital_clock_press()){
+            case (-1): break;
+            case (0): f_state = 0; break;
+            case (1): f_state = 2; break;
+            case (2): f_state = 3; break;
+            case (3): f_state = 4; break;
+        }
+    }
+}
\ No newline at end of file
--- a/drawStates.h	Thu May 25 09:48:31 2017 +0000
+++ b/drawStates.h	Thu May 25 10:13:13 2017 +0000
@@ -63,10 +63,10 @@
             //Date Area
             TFT.rect(50, 135, 320, 240, White);
             break;
-        case (3):
+        case (4):
             whiteboard();
             break;
-        case(4):
+        case(3):
             drawsettingsbuttons();
             drawoutlines();
             break;