Working Version of the Real Time Clock module DS1307.

Dependents:   Rtc_Ds1307_Sample TAREA_5_PROCESADORES Rtc_Ds1307_lcd_alarma Rtc_Ds1307_Reloj_con_alarma_aplazable ... more

This is my implementation of the DS1307.

I plan to add functionality which will make use of the OSC Input and which will increment the time continuously. A query to the module will then only have to be made when the MBED has been powered down.

Revision:
6:bba89618ee63
Parent:
5:30531f2121a2
Child:
7:dca20be3ef38
--- a/Rtc_Ds1307.h	Sun Jun 23 17:02:21 2013 +0000
+++ b/Rtc_Ds1307.h	Sun Jun 23 18:26:47 2013 +0000
@@ -24,6 +24,15 @@
 #define __RTC_DS1307_H__
 
 
+/** Class Rtc_Ds1307 implements the real time clock module DS1307
+ *
+ * You can read the clock and set a new time and date.
+ * It is also possible to start and stop the clock.
+ * Rtc_Ds1307 allows you to display the time in a 12h or 24h format
+ */
+class Rtc_Ds1307
+{
+
 /** Structure which is used to exchange the time and date
  */
 typedef struct {
@@ -44,15 +53,6 @@
     RS8kHz = 2,
     RS32kHz = 3
 } SqwRateSelect_t;
-
-/** Class Rtc_Ds1307 implements the real time clock module DS1307
- *
- * You can read the clock and set a new time and date.
- * It is also possible to start and stop the clock.
- * Rtc_Ds1307 allows you to display the time in a 12h or 24h format
- */
-class Rtc_Ds1307
-{
         I2C*    m_rtc;
         
         static const char *m_weekDays[];    
@@ -75,7 +75,7 @@
          *
          * @returns true if successful, otherwise an acknowledge error occured
          */
-        bool getTime(Time_rtc& time);
+        virtual bool getTime(Time_rtc& time);
         
         /** Write the given time onto the RTC chip
          *
@@ -87,7 +87,7 @@
          *
          * @returns true if successful, otherwise an acknowledge error occured
          */
-        bool setTime(Time_rtc& time, bool start, bool thm);        
+        virtual bool setTime(Time_rtc& time, bool start, bool thm);        
         
         /** Start the clock. Please note that the seconds register need to be read and
          * written in order to start or stop the clock. This can lead to an error
@@ -139,6 +139,4 @@
 
 
 };
-        
-
 #endif // __RTC_DS1307_H__
\ No newline at end of file