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

Revision:
38:3fe3bafbf0c7
Parent:
31:3255668e6b08
--- a/RTC.h	Thu May 25 16:01:06 2017 +0000
+++ b/RTC.h	Thu May 25 19:54:51 2017 +0000
@@ -1,10 +1,18 @@
 #include "Rtc_Ds1307.h"
+#include "math.h"
 Rtc_Ds1307 rtc(I2C_SDA, I2C_SCL);
 Rtc_Ds1307::Time_rtc tm_c = {};
 int tm_a_hr, tm_a_min = 0;
 char buffer[128];
 int readptr = 0;
 
+int date2day(int date,int month,int year){
+    int m = ((((month + 9) % 12 + 1) * 2.6) - 0.2);
+    int c = year / 100;
+    int y = year % 100;
+    int w = (date + m - 2 * c + y + y / 4 + (c / 4)) % 7;
+    return w;
+}
 
 void read_time()
 {
@@ -13,7 +21,7 @@
     do   {
         n++;
     } while(!rtc.getTime(tm_c));
-    
+    tm_c.wday = date2day(tm_c.date, tm_c.mon, tm_c.year);
 }
 
 void write()