Pinky and the Brain / Mbed OS Clock

Dependencies:   SPI_TFT_ILI9341 TFT_fonts Adafruit_RTCLib RTC-DS1307 TSI

Files at this revision

API Documentation at this revision

Comitter:
amilner1
Date:
Tue May 23 14:39:30 2017 +0000
Parent:
3:6795b827060b
Child:
5:fe6910712822
Commit message:
Clock face working

Changed in this revision

Display.cpp Show annotated file Show diff for this revision Revisions of this file
utility.h Show annotated file Show diff for this revision Revisions of this file
--- a/Display.cpp	Tue May 23 13:24:23 2017 +0000
+++ b/Display.cpp	Tue May 23 14:39:30 2017 +0000
@@ -11,11 +11,21 @@
     myTFT.cls();                // clear the screen
     myTFT.set_font((unsigned char*) Arial12x12);
     myTFT.locate(0,0);
-    printf(" 0 Hello Mbed 0");
-    printf("\n\rWidth: %d, Height: %d", myTFT.width(), myTFT.height());
 }
 
 void Display::drawClock(TimeClass *time)
 {
-    myTFT.circle(myTFT.width()/2, myTFT.height()/2, 30, 0x0000FF);
+    myTFT.circle(70, 70, 60, 0xFFFFFF);                 //
+    myTFT.line(70, 10, 70, 20, 0xFFFFFF);               // 12 oclock
+    myTFT.line(70, 130, 70, 120, 0xFFFFFF);             // 6 oclock
+    myTFT.line(10, 70, 20 , 70, 0xFFFFFF);              // 3 oclock
+    myTFT.line(120, 70, 130 , 70, 0xFFFFFF);            // 9 oclock
+    myTFT.line(100, 121.9615, 95, 113.301, 0xFFFFFF);   // 7 oclock
+    myTFT.line(40, 18.0385, 45, 26.699, 0xFFFFFF);      // 1 oclock
+    myTFT.line(121.9615, 100, 113.301, 95, 0xFFFFFF);   // 8 oclock
+    myTFT.line(18.0385, 40, 26.699, 45, 0xFFFFFF);      // 2 oclock
+    myTFT.line(121.9615,40,113.301,45, 0xFFFFFF);       // 4 oclock
+    myTFT.line(18.0385,100,26.699,95, 0xFFFFFF);        // 10 oclock
+    myTFT.line(100,18.0385,95,26.699, 0xFFFFFF);        // 5 oclock
+    myTFT.line(40,121.9615,45,113.301, 0xFFFFFF);       // 11 olcock
 }
\ No newline at end of file
--- a/utility.h	Tue May 23 13:24:23 2017 +0000
+++ b/utility.h	Tue May 23 14:39:30 2017 +0000
@@ -2,7 +2,10 @@
 #include "stdio.h"
 
 class TimeClass {
-    
+    public:
+        int hour;
+        int second;
+        int minute;
 };
 
 class StateClass {