Simple RTC class based on DS1307. Emphasis on simple. Allows you to run at 100k or 400k Hz (for newer DS1307 capable devices). MapTime() allows you to set the time() service to the same as the RTC. Uses struct tm throughout so you can use traditional time functions for manipulation.

Dependents:   AdaFruit_RGBLCD

Revision:
9:3a0ba8364ef2
Parent:
7:3621025e7949
Child:
10:e5eabd3a1ca6
--- a/RTclock.h	Mon Aug 11 19:10:09 2014 +0000
+++ b/RTclock.h	Sat Aug 30 15:55:28 2014 +0000
@@ -17,12 +17,19 @@
         eSWR_8kHz = 2,
         eSWR_32Hz = 3
     };
+    
+    enum EClockType
+    {
+        eDS1311,
+        eDS3231,
+    };
 
 public:
                             RTclock
                             (
                                 PinName             in_nSDA,
                                 PinName             in_nSCL,
+                                EClockType          in_eClockType,
                                 bool                in_bHiSpeed = false
                             );
     virtual                 ~RTclock();
@@ -59,8 +66,9 @@
                             );
 
 private:
-    static  const char *    m_aWeekDays[];              // Days of the week
+    static  const char *    m_aWeekDays[];              // Days of the week    
             bool            m_bTwelveHour;
+            EClockType      m_eClockType;
 };
 
 #endif // __RTCLOCK_H__