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:
Owenmatthewmcgowan
Date:
Thu May 25 11:04:31 2017 +0000
Parent:
19:4c30c3182e04
Parent:
15:796e17680825
Child:
21:bcdd41235b69
Child:
22:7a453c1d4d22
Commit message:
working demo updated with settings

Changed in this revision

drawStates.h Show annotated file Show diff for this revision Revisions of this file
drawStates.h.orig Show annotated file Show diff for this revision Revisions of this file
settings.h Show annotated file Show diff for this revision Revisions of this file
settings.h.orig Show diff for this revision Revisions of this file
--- a/drawStates.h	Thu May 25 10:58:02 2017 +0000
+++ b/drawStates.h	Thu May 25 11:04:31 2017 +0000
@@ -66,9 +66,11 @@
         case (4):
             whiteboard();
             break;
+
         case(3):
-            drawsettingsbuttons();
-            drawoutlines();
+            drawsettingback();
+            drawsettinganimate();
+
             break;
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/drawStates.h.orig	Thu May 25 11:04:31 2017 +0000
@@ -0,0 +1,77 @@
+
+
+void draw_state(int i)
+{
+    TFT.cls();
+    switch (i) {
+        case (1):
+            //buttons
+            TFT.fillrect(0, 0, 50, 50, Red);
+            TFT.fillrect(0, 50, 50, 100, Green);
+            TFT.fillrect(0, 100, 50, 150, Blue);
+            TFT.fillrect(0, 150, 50, 200, White);
+            TFT.fillrect(0, 200, 50, 240, Black);
+
+            TFT.rect(0, 0, 50, 50, White);
+            TFT.rect(0, 50, 50, 100, White);
+            TFT.rect(0, 100, 50, 150, White);
+            TFT.rect(0, 150, 50, 200, White);
+            TFT.rect(0, 200, 50, 240, White);
+            //clock area
+            TFT.rect(50, 0, 320, 100, White);
+            //Day
+            TFT.rect(50, 100, 140, 200, White);
+            //Alarm Area
+            TFT.rect(140, 100 , 320, 200, White);
+            //Date Area
+            TFT.rect(50, 200, 320, 240, White);
+            //Colons
+            int tx,ty = 0;
+            ty = 50;
+            tx = 140;
+            TFT.fillcircle(tx, ty - 10, 2, White);
+            TFT.fillcircle(tx, ty + 10, 2, White);
+            tx = 230;
+            TFT.fillcircle(tx, ty - 10, 2, White);
+            TFT.fillcircle(tx, ty + 10, 2, White);
+            ty = 150;
+            TFT.fillcircle(tx, ty - 10, 2, White);
+            TFT.fillcircle(tx, ty + 10, 2, White);
+            break;
+        case (2):
+            //buttons
+            TFT.fillrect(0, 0, 50, 50, Red);
+            TFT.fillrect(0, 50, 50, 100, Green);
+            TFT.fillrect(0, 100, 50, 150, Blue);
+            TFT.fillrect(0, 150, 50, 200, White);
+            TFT.fillrect(0, 200, 50, 240, Black);
+
+            TFT.rect(0, 0, 50, 50, White);
+            TFT.rect(0, 50, 50, 100, White);
+            TFT.rect(0, 100, 50, 150, White);
+            TFT.rect(0, 150, 50, 200, White);
+            TFT.rect(0, 200, 50, 240, White);
+            //Date Area
+
+            //clock area
+            TFT.rect(50, 0, 185, 1355, White);
+            int r = 135/2;
+            draw_clockface(50 + r, r, r, 3, White);
+            //Alarm Area
+            draw_clockface(185 + r, r, r, 3, White);
+            TFT.rect(185, 0, 320, 1355, White);
+            //Date Area
+            TFT.rect(50, 135, 320, 240, White);
+            break;
+        case (4):
+            whiteboard();
+            break;
+        case(3):
+            drawsettingsbuttons();
+            drawoutlines();
+            break;
+    }
+}
+
+
+
--- a/settings.h	Thu May 25 10:58:02 2017 +0000
+++ b/settings.h	Thu May 25 11:04:31 2017 +0000
@@ -1,79 +1,98 @@
 
 
-void drawsettingsbuttons() //Navigation Buttons
+void drawsettingback() //Navigation Buttons
 {
-  TFT.fillrect(0,0,50,100,Blue);        //ste alarm button
+  TFT.fillrect(0,0,50,100,Blue);        //set alarm button
     TFT.fillrect(0,100,50,200,White);   //set time button
-    TFT.fillrect(0,200,50,240,Green);   //home button
 
  
     TFT.rect(0,0,50,100,Blue);      //outlines
     TFT.rect(0,100,50,200,White);   //outlines
     TFT.rect(0,200,50,240,White);   //outlines
     
-    //set New button (used to set new alarm/time/date)
-    TFT.set_font((unsigned char*) Arial12x12); 
-    TFT.locate(71,25);
-    TFT.set_orientation(0);
+    //alarm/time colons
+            int tx,ty = 0;
+            ty = 50;
+            tx = 185;
+            TFT.fillcircle(tx, ty - 10, 2, White);
+            TFT.fillcircle(tx, ty + 10, 2, White);
+            ty = 150;
+            TFT.fillcircle(tx, ty - 10, 2, White);
+            TFT.fillcircle(tx, ty + 10, 2, White);
     
-    TFT.printf("Cancel");
-    TFT.set_orientation(1);
 
-    //Full reset button
-    TFT.locate(170,25);
-    TFT.set_orientation(0);
-    TFT.printf("Set New");
-    TFT.set_orientation(1);
-     //home button
-    TFT.locate(0,210);
-    TFT.printf("Home");
-    
 }
 
-void drawoutlines() //draw alarm, time, date
+void drawsettinganimate() //draw alarm, time, date
 {
     TFT.rect(50,0,320,100,Blue);  //set alarm box
     TFT.rect(50,100,320,200,White); //set time box
     TFT.rect(50,200,320,240,White); //set date box
 
     TFT.set_font((unsigned char*) Arial12x12); //set alarm title
-    TFT.locate(105,0);
+    TFT.locate(157,8);
     TFT.printf("Set Alarm");
 
 
     TFT.set_font((unsigned char*) Arial28x28); //set alarm hour
 
-    TFT.locate(50,30);
+    TFT.locate(90,40);
+
     TFT.printf("AH");//Alarm_Hour
 
      //set alarm mins
-    TFT.locate(230,30);
-    TFT.printf("Am");//Alarm_Min
-    
+    TFT.locate(230,40);
+    TFT.printf("AM");//Alarm_Min
     TFT.set_font((unsigned char*) Arial12x12); //set time title
-    TFT.locate(105,100);
+    TFT.locate(157,108);
     TFT.printf("Set Time");
 
-    TFT.set_font((unsigned char*) Arial24x23); //set time hour
-    TFT.locate(50,130);
+    TFT.set_font((unsigned char*) Arial28x28); //set time hour
+    TFT.locate(90,140);
     TFT.printf("TH"); // Time_hour
     
     //set time mins
-    TFT.locate(230,130);
+    TFT.locate(230,140);
     TFT.printf("TM");//Time Min
 
-    TFT.set_font((unsigned char*) Arial12x12);//set date day
-    TFT.locate(50,200);
+    //set date day
+    TFT.set_font((unsigned char*) Arial12x12);
+    TFT.locate(60,215);
     TFT.printf("day");
 
     //set date month
-    TFT.locate(120,200);
+    TFT.locate(150,215);
     TFT.printf("month");
 
     //set date year
-    TFT.locate(190,200);
+    TFT.locate(265,215);
     TFT.printf("year");
 
+    //Cancel button 
+    TFT.set_font((unsigned char*) Arial12x12); 
+    TFT.locate(62,20);
+    TFT.set_orientation(0);
+    TFT.background(White);
+    TFT.foreground(Black);
+    TFT.printf("Cancel");
+    TFT.background(Black);
+    TFT.foreground(White);
+    TFT.set_orientation(1);
+
+    //Set New button (used to set new alarm/time/date)
+    
+    TFT.locate(161,20);
+    TFT.set_orientation(0);
+    TFT.background(Blue);
+    TFT.printf("Set New");
+    TFT.background(Black);
+    TFT.set_orientation(1);
+     //home button
+    TFT.locate(5,217);
+    TFT.foreground(Blue);
+    TFT.printf("Home");
+    TFT.foreground(White);
+
     
 }
 void settingslogic() {
--- a/settings.h.orig	Thu May 25 10:58:02 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-
-
-void drawsettingsbuttons() //Navigation Buttons
-{
-  TFT.fillrect(0,0,50,100,Blue);        //ste alarm button
-    TFT.fillrect(0,100,50,200,White);   //set time button
-    TFT.fillrect(0,200,50,240,Green);   //home button
-
- 
-    TFT.rect(0,0,50,100,Blue);      //outlines
-    TFT.rect(0,100,50,200,White);   //outlines
-    TFT.rect(0,200,50,240,White);   //outlines
-    
-    //set New button (used to set new alarm/time/date)
-    TFT.set_font((unsigned char*) Arial12x12); 
-    TFT.locate(0,40);
-    TFT.printf("Set New");
-
-    //Full reset button
-    TFT.locate(0,140);
-    TFT.printf("Full reset");
-
-     //home button
-    TFT.locate(0,210);
-    TFT.printf("Home");
-    
-}
-
-void drawoutlines() //draw alarm, time, date
-{
-    TFT.rect(50,0,320,100,Blue);  //set alarm box
-    TFT.rect(50,100,320,200,White); //set time box
-    TFT.rect(50,200,320,240,White); //set date box
-    
-    TFT.set_font((unsigned char*) Arial12x12); //set alarm title
-    TFT.locate(105,0);
-    TFT.printf("Set Alarm");
-
-    TFT.set_font((unsigned char*) Arial24x23); //set alarm hour
-    TFT.locate(50,30);
-    TFT.printf("Alarm_Hour");
-
-     //set alarm mins
-    TFT.locate(230,30);
-    TFT.printf("Alarm_Min");
-    
-    TFT.set_font((unsigned char*) Arial12x12); //set time title
-    TFT.locate(105,100);
-    TFT.printf("Set Time");
-
-    TFT.set_font((unsigned char*) Arial24x23); //set time hour
-    TFT.locate(50,130);
-    TFT.printf("Time_Hour");
-    
-    //set time mins
-    TFT.locate(230,130);
-    TFT.printf("Alarm_Min");
-
-    TFT.set_font((unsigned char*) Arial12x12);//set date day
-    TFT.locate(50,200);
-    TFT.printf("day");
-
-    //set date month
-    TFT.locate(120,200);
-    TFT.printf("month");
-
-    //set date year
-    TFT.locate(190,200);
-    TFT.printf("year");
-
-    
-}
-void settingslogic() {
-    
-    }
\ No newline at end of file