Engleski nazivi dana u tjednu su zamijenjeni kraticama dana u tjednu na hrvatskom jeziku.

Dependents:   SUSTAV_KONTROLE_PRISTUPA

Revision:
2:ee81f2c5a706
Parent:
1:64274190e842
Child:
5:30531f2121a2
--- a/Rtc_Ds1307.h	Sun Jun 02 18:57:26 2013 +0000
+++ b/Rtc_Ds1307.h	Wed Jun 05 20:42:37 2013 +0000
@@ -25,16 +25,29 @@
 
 #include "mbed.h"
 
+/** Structure which is used to exchange the time and date
+ */
 typedef struct {
-    int sec;
-    int min;
-    int hour;
-    int wday;
-    int date;
-    int mon;
-    int year;
+    int sec;        /*!< seconds [0..59] */
+    int min;        /*!< minutes {0..59] */
+    int hour;       /*!< hours [0..23] */
+    int wday;       /*!< weekday [1..7, where 1 = sunday, 2 = monday, ... */
+    int date;       /*!< day of month [0..31] */
+    int mon;        /*!< month of year [1..12] */
+    int year;       /*!< year [2000..2255] */
 } Time;
 
+/** RateSelect specifies the valid frequency values for the square wave output
+ */
+typedef enum {
+    RS_1Hz=   0,         /*!< 1 Hz frequency output */
+    RS_4kHz=  1,         /*!< 4.096 kHz frequency output */
+    RS_8kHz=  2,         /*!< 8.192 kHz frequency output */
+    RS_32kHz= 3          /*!< 32.768 kHz frequency output */
+    
+} RateSelect_t;
+
+
 /** Class Rtc_Ds1307 implements the real time clock module DS1307
  *
  * You can read the clock and set a new time and date.
@@ -79,6 +92,23 @@
          */
         bool setTime(Time& 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
+         * in the time value. The recommended way of starting and stoping the clock is
+         * to write the actual date and time and set the start bit accordingly.
+         *
+         * @returns true if the clock was started, false if a communication error occured
+         */
+        bool startClock();
+        
+        /** Stop 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
+         * in the time value. The recommended way of starting and stoping the clock is
+         * to write the actual date and time and set the start bit accordingly.
+         *
+         * @returns true if the clock was stopped, false if a communication error occured
+         */
+        bool stopClock();
         
         /** Service function to convert a weekday into a string representation
          *
@@ -89,6 +119,17 @@
         const char* weekdayToString( int wday )
         { return m_weekDays[wday%7]; }
 
+        /** Enable Square Wave output. The function enables or disables the square wave output
+         * of the module and sets the desired frequency.
+         *
+         * @param ena : if set to true, the square wave output is enabled.
+         *
+         * @param rs : rate select, can be either one of the four values defined by type /c RateSelect_t
+         *
+         * @return true if the operation was successful or false otherwise
+         */
+        bool setSquareWaveOutput(bool ena, RateSelect_t rs);
+        
     private:
         bool read(int address, char* buffer, int len);
         bool write(int address, char* buffer, int len);