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.
Diff: RTclock.h
- Revision:
- 5:d71d6e5a7eee
- Parent:
- 0:98b84d9c8c96
- Child:
- 6:984fd3ba519a
--- a/RTclock.h Sat Aug 09 11:46:08 2014 +0000 +++ b/RTclock.h Sat Aug 09 17:02:40 2014 +0000 @@ -27,7 +27,8 @@ ); virtual ~RTclock(); - virtual bool MapTime(); // Maps RTC chip to C time.h time system + bool IsTwelveHour(); // true if set to a 12hr clock + virtual bool MapTime(); // Maps RTC chip to C time.h time system virtual bool GetTime(tm & out_sTM); // Get a TM structure directly static const char * GetWeekday(int in_nWeekDay); virtual bool SetSquareWaveOutput @@ -35,7 +36,11 @@ bool in_bEnable, ESquareWaveRates in_nRateSelect ); - virtual bool SetTime(const tm & in_sTM); // Set time time using a TM structure (always starts) + virtual bool SetTime // Set time time using a TM structure (always starts) + ( + const tm & in_sTM, + bool in_bTwelveHour + ); protected: static int BcdToDecimal(int in_nBCD); @@ -55,7 +60,8 @@ ); private: - static const char * m_aWeekDays[]; // Days of the week + static const char * m_aWeekDays[]; // Days of the week + bool m_bTwelveHour; }; #endif // __RTCLOCK_H__