Support KL25z requirements
Fork of RTC by
RTC.h@0:39767ffe05e6, 2012-12-05 (annotated)
- Committer:
- Sissors
- Date:
- Wed Dec 05 21:03:44 2012 +0000
- Revision:
- 0:39767ffe05e6
- Child:
- 1:be9d058ee5c7
Version 1, lacks comments, seems to work
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Sissors | 0:39767ffe05e6 | 1 | #ifndef RTC_H |
Sissors | 0:39767ffe05e6 | 2 | #define RTC_H |
Sissors | 0:39767ffe05e6 | 3 | |
Sissors | 0:39767ffe05e6 | 4 | #include "mbed.h" |
Sissors | 0:39767ffe05e6 | 5 | |
Sissors | 0:39767ffe05e6 | 6 | |
Sissors | 0:39767ffe05e6 | 7 | class RTC { |
Sissors | 0:39767ffe05e6 | 8 | public: |
Sissors | 0:39767ffe05e6 | 9 | enum TimeUnit {Second, Minute, Hour, |
Sissors | 0:39767ffe05e6 | 10 | Day, Month, Year}; |
Sissors | 0:39767ffe05e6 | 11 | |
Sissors | 0:39767ffe05e6 | 12 | static void attach(void (*function)(void), TimeUnit interval); |
Sissors | 0:39767ffe05e6 | 13 | |
Sissors | 0:39767ffe05e6 | 14 | static void alarm(void (*function)(void), tm time); |
Sissors | 0:39767ffe05e6 | 15 | |
Sissors | 0:39767ffe05e6 | 16 | static void alarmOff( void ); |
Sissors | 0:39767ffe05e6 | 17 | |
Sissors | 0:39767ffe05e6 | 18 | private: |
Sissors | 0:39767ffe05e6 | 19 | static void IRQHandler( void ); |
Sissors | 0:39767ffe05e6 | 20 | |
Sissors | 0:39767ffe05e6 | 21 | static FunctionPointer attachCB[6]; |
Sissors | 0:39767ffe05e6 | 22 | static FunctionPointer alarmCB; |
Sissors | 0:39767ffe05e6 | 23 | |
Sissors | 0:39767ffe05e6 | 24 | //If someone knows a nicer way to do this, please tell me |
Sissors | 0:39767ffe05e6 | 25 | static bool initialRun; |
Sissors | 0:39767ffe05e6 | 26 | |
Sissors | 0:39767ffe05e6 | 27 | |
Sissors | 0:39767ffe05e6 | 28 | }; |
Sissors | 0:39767ffe05e6 | 29 | |
Sissors | 0:39767ffe05e6 | 30 | #endif |