Working Version of the Real Time Clock module DS1307.
Fork of RTC-DS1307 by
Diff: Rtc_Ds1307.h
- Revision:
- 5:30531f2121a2
- Parent:
- 2:ee81f2c5a706
- Child:
- 6:bba89618ee63
diff -r d2cc690aaac7 -r 30531f2121a2 Rtc_Ds1307.h --- a/Rtc_Ds1307.h Sun Jun 23 16:29:35 2013 +0000 +++ b/Rtc_Ds1307.h Sun Jun 23 17:02:21 2013 +0000 @@ -23,7 +23,6 @@ #ifndef __RTC_DS1307_H__ #define __RTC_DS1307_H__ -#include "mbed.h" /** Structure which is used to exchange the time and date */ @@ -35,18 +34,16 @@ int date; /*!< day of month [0..31] */ int mon; /*!< month of year [1..12] */ int year; /*!< year [2000..2255] */ -} Time; +} Time_rtc; /** 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; - + RS1Hz = 0, + RS4kHz = 1, + RS8kHz = 2, + RS32kHz = 3 +} SqwRateSelect_t; /** Class Rtc_Ds1307 implements the real time clock module DS1307 * @@ -78,7 +75,7 @@ * * @returns true if successful, otherwise an acknowledge error occured */ - bool getTime(Time& time); + bool getTime(Time_rtc& time); /** Write the given time onto the RTC chip * @@ -90,7 +87,7 @@ * * @returns true if successful, otherwise an acknowledge error occured */ - bool setTime(Time& time, bool start, bool thm); + 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 @@ -128,7 +125,7 @@ * * @return true if the operation was successful or false otherwise */ - bool setSquareWaveOutput(bool ena, RateSelect_t rs); + bool setSquareWaveOutput(bool ena, SqwRateSelect_t rs); private: bool read(int address, char* buffer, int len);