Si-Labs EFM32 back up domain and BUrtc library
Diff: BUrtc.h
- Revision:
- 0:7756f444d879
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BUrtc.h Mon May 16 23:12:27 2016 +0000 @@ -0,0 +1,42 @@ +#ifndef __BUrtc_H +#define __BUrtc_H + +#include "mbed.h" +#include "em_emu.h" +#include "em_rmu.h" +#include "em_burtc.h" + +#define UINT32_MAX 4294967295UL + +/* This variables must reflect BURTC frequency */ +#define COUNTS_PER_SEC (32768/128) +/* Clock defines */ +#define LFXO_FREQUENCY 32768 +#define BURTC_PRESCALING 128 +#define UPDATE_INTERVAL 1 +//#define COUNTS_PER_SEC (LFXO_FREQUENCY/BURTC_PRESCALING) +#define COUNTS_BETWEEN_UPDATE (UPDATE_INTERVAL*COUNTS_PER_SEC) + + +void BUrtcInit(void); +void budSetup(void); +void burtcSetup(void); +void RTCset(int seconds); +void RTCrestore(void); +void BURTC_IRQHandler(void); +void BUrtcBackup(void); + +static int burtcCount; +static int burtcOverflowCounter; +static int burtcOverflowIntervalRem; +static int burtcTimestamp; +static int rtcStartTime; +static int rtcOverflowCounter; +static int overflow_interval; +static int overflow_interval_r; + +static int trtc; +static int lcdUpdate; +static int resetcause; + +#endif