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
RtcCls.h@5:30531f2121a2, 2013-06-23 (annotated)
- Committer:
- leihen
- Date:
- Sun Jun 23 17:02:21 2013 +0000
- Revision:
- 5:30531f2121a2
- Parent:
- 4:d2cc690aaac7
- Child:
- 6:bba89618ee63
Update
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| leihen | 5:30531f2121a2 | 1 | #ifndef __DAMNFILEHEADER__ |
| leihen | 5:30531f2121a2 | 2 | #define __DAMNFILEHEADER__ |
| leihen | 5:30531f2121a2 | 3 | |
| leihen | 4:d2cc690aaac7 | 4 | |
| leihen | 4:d2cc690aaac7 | 5 | #include "Rtc_Ds1307.h" |
| leihen | 4:d2cc690aaac7 | 6 | |
| leihen | 4:d2cc690aaac7 | 7 | typedef void (*callback_t)(void); |
| leihen | 4:d2cc690aaac7 | 8 | |
| leihen | 4:d2cc690aaac7 | 9 | class RtcCls : public Rtc_Ds1307 |
| leihen | 4:d2cc690aaac7 | 10 | { |
| leihen | 5:30531f2121a2 | 11 | protected: |
| leihen | 5:30531f2121a2 | 12 | // InterruptIn m_sqw; |
| leihen | 5:30531f2121a2 | 13 | bool m_bUseSqw; |
| leihen | 5:30531f2121a2 | 14 | time_t m_time; // Only used in case of SQW use |
| leihen | 5:30531f2121a2 | 15 | |
| leihen | 5:30531f2121a2 | 16 | bool m_bAlarmEnabled; |
| leihen | 5:30531f2121a2 | 17 | callback_t m_alarmfunc; |
| leihen | 5:30531f2121a2 | 18 | time_t m_alarmTime; |
| leihen | 5:30531f2121a2 | 19 | |
| leihen | 5:30531f2121a2 | 20 | public: |
| leihen | 5:30531f2121a2 | 21 | RtcCls(PinName sda, PinName scl, PinName sqw, bool bUseSqw); |
| leihen | 4:d2cc690aaac7 | 22 | |
| leihen | 5:30531f2121a2 | 23 | protected: |
| leihen | 5:30531f2121a2 | 24 | static void _callback(void); |
| leihen | 5:30531f2121a2 | 25 | |
| leihen | 5:30531f2121a2 | 26 | public: |
| leihen | 5:30531f2121a2 | 27 | time_t getTime(); |
| leihen | 5:30531f2121a2 | 28 | void setTime(time_t t); |
| leihen | 5:30531f2121a2 | 29 | public: |
| leihen | 5:30531f2121a2 | 30 | void setAlarm(int nSeconds, callback_t alarmfunc) { |
| leihen | 5:30531f2121a2 | 31 | m_alarmfunc = alarmfunc; |
| leihen | 5:30531f2121a2 | 32 | m_alarmTime = m_time + nSeconds; |
| leihen | 5:30531f2121a2 | 33 | m_bAlarmEnabled = (alarmfunc == NULL) ? false : true; |
| leihen | 5:30531f2121a2 | 34 | } |
| leihen | 4:d2cc690aaac7 | 35 | }; |
| leihen | 5:30531f2121a2 | 36 | #endif // __RTC_CLS_H__ |