Si-Labs EFM32 back up domain and BUrtc library
BUrtc.h@0:7756f444d879, 2016-05-16 (annotated)
- Committer:
- star297
- Date:
- Mon May 16 23:12:27 2016 +0000
- Revision:
- 0:7756f444d879
BUrtc initial release
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
star297 | 0:7756f444d879 | 1 | #ifndef __BUrtc_H |
star297 | 0:7756f444d879 | 2 | #define __BUrtc_H |
star297 | 0:7756f444d879 | 3 | |
star297 | 0:7756f444d879 | 4 | #include "mbed.h" |
star297 | 0:7756f444d879 | 5 | #include "em_emu.h" |
star297 | 0:7756f444d879 | 6 | #include "em_rmu.h" |
star297 | 0:7756f444d879 | 7 | #include "em_burtc.h" |
star297 | 0:7756f444d879 | 8 | |
star297 | 0:7756f444d879 | 9 | #define UINT32_MAX 4294967295UL |
star297 | 0:7756f444d879 | 10 | |
star297 | 0:7756f444d879 | 11 | /* This variables must reflect BURTC frequency */ |
star297 | 0:7756f444d879 | 12 | #define COUNTS_PER_SEC (32768/128) |
star297 | 0:7756f444d879 | 13 | /* Clock defines */ |
star297 | 0:7756f444d879 | 14 | #define LFXO_FREQUENCY 32768 |
star297 | 0:7756f444d879 | 15 | #define BURTC_PRESCALING 128 |
star297 | 0:7756f444d879 | 16 | #define UPDATE_INTERVAL 1 |
star297 | 0:7756f444d879 | 17 | //#define COUNTS_PER_SEC (LFXO_FREQUENCY/BURTC_PRESCALING) |
star297 | 0:7756f444d879 | 18 | #define COUNTS_BETWEEN_UPDATE (UPDATE_INTERVAL*COUNTS_PER_SEC) |
star297 | 0:7756f444d879 | 19 | |
star297 | 0:7756f444d879 | 20 | |
star297 | 0:7756f444d879 | 21 | void BUrtcInit(void); |
star297 | 0:7756f444d879 | 22 | void budSetup(void); |
star297 | 0:7756f444d879 | 23 | void burtcSetup(void); |
star297 | 0:7756f444d879 | 24 | void RTCset(int seconds); |
star297 | 0:7756f444d879 | 25 | void RTCrestore(void); |
star297 | 0:7756f444d879 | 26 | void BURTC_IRQHandler(void); |
star297 | 0:7756f444d879 | 27 | void BUrtcBackup(void); |
star297 | 0:7756f444d879 | 28 | |
star297 | 0:7756f444d879 | 29 | static int burtcCount; |
star297 | 0:7756f444d879 | 30 | static int burtcOverflowCounter; |
star297 | 0:7756f444d879 | 31 | static int burtcOverflowIntervalRem; |
star297 | 0:7756f444d879 | 32 | static int burtcTimestamp; |
star297 | 0:7756f444d879 | 33 | static int rtcStartTime; |
star297 | 0:7756f444d879 | 34 | static int rtcOverflowCounter; |
star297 | 0:7756f444d879 | 35 | static int overflow_interval; |
star297 | 0:7756f444d879 | 36 | static int overflow_interval_r; |
star297 | 0:7756f444d879 | 37 | |
star297 | 0:7756f444d879 | 38 | static int trtc; |
star297 | 0:7756f444d879 | 39 | static int lcdUpdate; |
star297 | 0:7756f444d879 | 40 | static int resetcause; |
star297 | 0:7756f444d879 | 41 | |
star297 | 0:7756f444d879 | 42 | #endif |