pong game added to the main sketch

Dependencies:   RTC-DS1307 SPI_TFT_ILI9341 TFT_fonts mbed tsi_sensor

Fork of MainSketch by IoT Ox

Files at this revision

API Documentation at this revision

Comitter:
Owenmatthewmcgowan
Date:
Wed May 24 16:15:04 2017 +0000
Parent:
11:1da15361a35b
Commit message:
Added Settings page

Changed in this revision

drawStates.h Show annotated file Show diff for this revision Revisions of this file
libs.h Show annotated file Show diff for this revision Revisions of this file
main.cpp 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
--- a/drawStates.h	Wed May 24 13:27:07 2017 +0000
+++ b/drawStates.h	Wed May 24 16:15:04 2017 +0000
@@ -65,6 +65,11 @@
             break;
         case (3):
             whiteboard();
+            break;
+        case(4):
+            drawsettingsbuttons();
+            drawoutlines();
+            break;
     }
 }
 
--- a/libs.h	Wed May 24 13:27:07 2017 +0000
+++ b/libs.h	Wed May 24 16:15:04 2017 +0000
@@ -4,7 +4,9 @@
 #endif
 Serial pc(USBTX,USBRX,"pc");
 #include "poll.h"
+
 #include "render.h"
+#include "settings.h"
 #include "drawStates.h"
 #include "RTC.h"
 #include "slider.h"
--- a/main.cpp	Wed May 24 13:27:07 2017 +0000
+++ b/main.cpp	Wed May 24 16:15:04 2017 +0000
@@ -1,7 +1,8 @@
 #include "libs.h"
 int f_state, f_button;
+//DigitalOut led(LED1);
 bool f_alarm;
-DigitalIn sw_w(SW3);
+//DigitalIn sw_w(SW3);
 
 void main()
 {
@@ -11,12 +12,13 @@
     TFT.foreground(White);    // set chars to white
     TFT.cls();
     // pc.baud(115200);
-    int i = 0;
+    /*int i = 0;
     while (true) {
         i = (i % 3) + 1;
         draw_state(i);
         wait(1);
-    }
+    }*/
+    draw_state(4);
 
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/settings.h	Wed May 24 16:15:04 2017 +0000
@@ -0,0 +1,72 @@
+
+
+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*) Arial28x28); //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*) Arial28x28); //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");
+
+    
+}
\ No newline at end of file