Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Detektor_Pokreta Dino_Martic_Programski
Diff: RtcCls.h
- Revision:
- 4:d2cc690aaac7
- Child:
- 5:30531f2121a2
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/RtcCls.h Sun Jun 23 16:29:35 2013 +0000
@@ -0,0 +1,38 @@
+#ifndef __RTC_H__
+#define __RTC_H__
+
+#include "Rtc_Ds1307.h"
+#include "mbed.h"
+
+typedef void (*callback_t)(void);
+
+class RtcCls : public Rtc_Ds1307
+{
+ protected:
+ InterruptIn m_sqw;
+ bool m_bUseSqw;
+ time_t m_time; // Only used in case of SQW use
+
+ bool m_bAlarmEnabled;
+ callback_t m_alarmfunc;
+ time_t m_alarmTime;
+
+ public:
+ RtcCls(PinName sda, PinName scl, PinName sqw, bool bUseSqw);
+
+ protected:
+ static void _callback(void);
+
+ public:
+ time_t getTime();
+ void setTime(time_t t);
+ public:
+ void setAlarm(int nSeconds, callback_t alarmfunc)
+ {
+ m_alarmfunc = alarmfunc;
+ m_alarmTime = m_time + nSeconds;
+ m_bAlarmEnabled = (alarmfunc == NULL) ? false : true;
+ }
+};
+
+#endif // __RTC_H__
\ No newline at end of file