37 #if defined( RTCC_COUNT ) && ( RTCC_COUNT == 1 )
57 #if defined(_SILICON_LABS_GECKO_INTERNAL_SDID_84) \
58 || defined(_SILICON_LABS_GECKO_INTERNAL_SDID_89)
61 #define ERRATA_FIX_RTCC_E203
64 #if defined(_SILICON_LABS_GECKO_INTERNAL_SDID_84)
67 #define ERRATA_FIX_RTCC_E204
79 rtccCntModeNormal = _RTCC_CTRL_CNTTICK_PRESC,
83 rtccCntModeCalendar = _RTCC_CTRL_CNTTICK_CCV0MATCH
84 } RTCC_CntMode_TypeDef;
89 rtccCntPresc_1 = _RTCC_CTRL_CNTPRESC_DIV1,
90 rtccCntPresc_2 = _RTCC_CTRL_CNTPRESC_DIV2,
91 rtccCntPresc_4 = _RTCC_CTRL_CNTPRESC_DIV4,
92 rtccCntPresc_8 = _RTCC_CTRL_CNTPRESC_DIV8,
93 rtccCntPresc_16 = _RTCC_CTRL_CNTPRESC_DIV16,
94 rtccCntPresc_32 = _RTCC_CTRL_CNTPRESC_DIV32,
95 rtccCntPresc_64 = _RTCC_CTRL_CNTPRESC_DIV64,
96 rtccCntPresc_128 = _RTCC_CTRL_CNTPRESC_DIV128,
97 rtccCntPresc_256 = _RTCC_CTRL_CNTPRESC_DIV256,
98 rtccCntPresc_512 = _RTCC_CTRL_CNTPRESC_DIV512,
99 rtccCntPresc_1024 = _RTCC_CTRL_CNTPRESC_DIV1024,
100 rtccCntPresc_2048 = _RTCC_CTRL_CNTPRESC_DIV2048,
101 rtccCntPresc_4096 = _RTCC_CTRL_CNTPRESC_DIV4096,
102 rtccCntPresc_8192 = _RTCC_CTRL_CNTPRESC_DIV8192,
103 rtccCntPresc_16384 = _RTCC_CTRL_CNTPRESC_DIV16384,
104 rtccCntPresc_32768 = _RTCC_CTRL_CNTPRESC_DIV32768
105 } RTCC_CntPresc_TypeDef;
112 rtccCntTickPresc = _RTCC_CTRL_CNTTICK_PRESC,
116 rtccCntTickCCV0Match = _RTCC_CTRL_CNTTICK_CCV0MATCH
117 } RTCC_PrescMode_TypeDef;
123 rtccCapComChModeOff = _RTCC_CC_CTRL_MODE_OFF,
124 rtccCapComChModeCapture = _RTCC_CC_CTRL_MODE_INPUTCAPTURE,
125 rtccCapComChModeCompare = _RTCC_CC_CTRL_MODE_OUTPUTCOMPARE,
126 } RTCC_CapComChMode_TypeDef;
131 rtccCompMatchOutActionPulse = _RTCC_CC_CTRL_CMOA_PULSE,
132 rtccCompMatchOutActionToggle = _RTCC_CC_CTRL_CMOA_TOGGLE,
133 rtccCompMatchOutActionClear = _RTCC_CC_CTRL_CMOA_CLEAR,
134 rtccCompMatchOutActionSet = _RTCC_CC_CTRL_CMOA_SET
135 } RTCC_CompMatchOutAction_TypeDef;
141 rtccPRSCh0 = _RTCC_CC_CTRL_PRSSEL_PRSCH0,
142 rtccPRSCh1 = _RTCC_CC_CTRL_PRSSEL_PRSCH1,
143 rtccPRSCh2 = _RTCC_CC_CTRL_PRSSEL_PRSCH2,
144 rtccPRSCh3 = _RTCC_CC_CTRL_PRSSEL_PRSCH3,
145 rtccPRSCh4 = _RTCC_CC_CTRL_PRSSEL_PRSCH4,
146 rtccPRSCh5 = _RTCC_CC_CTRL_PRSSEL_PRSCH5,
147 rtccPRSCh6 = _RTCC_CC_CTRL_PRSSEL_PRSCH6,
148 rtccPRSCh7 = _RTCC_CC_CTRL_PRSSEL_PRSCH7,
149 rtccPRSCh8 = _RTCC_CC_CTRL_PRSSEL_PRSCH8,
150 rtccPRSCh9 = _RTCC_CC_CTRL_PRSSEL_PRSCH9,
151 rtccPRSCh10 = _RTCC_CC_CTRL_PRSSEL_PRSCH10,
152 rtccPRSCh11 = _RTCC_CC_CTRL_PRSSEL_PRSCH11
153 } RTCC_PRSSel_TypeDef;
159 rtccInEdgeRising = _RTCC_CC_CTRL_ICEDGE_RISING,
160 rtccInEdgeFalling = _RTCC_CC_CTRL_ICEDGE_FALLING,
161 rtccInEdgeBoth = _RTCC_CC_CTRL_ICEDGE_BOTH,
162 rtccInEdgeNone = _RTCC_CC_CTRL_ICEDGE_NONE
163 } RTCC_InEdgeSel_TypeDef;
170 rtccCompBaseCnt = _RTCC_CC_CTRL_COMPBASE_CNT,
173 rtccCompBasePreCnt = _RTCC_CC_CTRL_COMPBASE_PRECNT
174 } RTCC_CompBase_TypeDef;
179 rtccDayCompareModeMonth = _RTCC_CC_CTRL_DAYCC_MONTH,
180 rtccDayCompareModeWeek = _RTCC_CC_CTRL_DAYCC_WEEK
181 } RTCC_DayCompareMode_TypeDef;
197 bool precntWrapOnCCV0;
203 RTCC_CntPresc_TypeDef presc;
206 RTCC_PrescMode_TypeDef prescMode;
208 #if defined(_RTCC_CTRL_BUMODETSEN_MASK)
211 bool enaBackupModeSet;
216 bool enaOSCFailDetect;
219 RTCC_CntMode_TypeDef cntMode;
224 bool disLeapYearCorr;
232 RTCC_CapComChMode_TypeDef chMode;
235 RTCC_CompMatchOutAction_TypeDef compMatchOutAction;
238 RTCC_PRSSel_TypeDef prsSel;
241 RTCC_InEdgeSel_TypeDef inputEdgeSel;
244 RTCC_CompBase_TypeDef compBase;
251 RTCC_DayCompareMode_TypeDef dayCompMode;
252 } RTCC_CCChConf_TypeDef;
260 #if defined(_RTCC_CTRL_BUMODETSEN_MASK)
261 #define RTCC_INIT_DEFAULT \
275 #define RTCC_INIT_DEFAULT \
290 #define RTCC_CH_INIT_COMPARE_DEFAULT \
292 rtccCapComChModeCompare, \
293 rtccCompMatchOutActionPulse, \
298 rtccDayCompareModeMonth \
302 #define RTCC_CH_INIT_CAPTURE_DEFAULT \
304 rtccCapComChModeCapture, \
305 rtccCompMatchOutActionPulse, \
310 rtccDayCompareModeMonth \
314 #define RTCC_CH_VALID( ch ) ( ( ch ) < 3 )
330 __STATIC_INLINE uint32_t RTCC_ChannelCCVGet(
int ch )
332 EFM_ASSERT( RTCC_CH_VALID( ch ) );
333 return RTCC->CC[ ch ].CCV;
346 __STATIC_INLINE
void RTCC_ChannelCCVSet(
int ch, uint32_t value )
348 EFM_ASSERT( RTCC_CH_VALID( ch ) );
349 RTCC->CC[ ch ].CCV = value;
362 __STATIC_INLINE uint32_t RTCC_ChannelDateGet(
int ch )
364 EFM_ASSERT( RTCC_CH_VALID( ch ) );
365 return RTCC->CC[ ch ].DATE;
378 __STATIC_INLINE
void RTCC_ChannelDateSet(
int ch, uint32_t date )
380 EFM_ASSERT( RTCC_CH_VALID( ch ) );
381 RTCC->CC[ ch ].DATE = date;
384 void RTCC_ChannelInit(
int ch, RTCC_CCChConf_TypeDef
const *confPtr );
396 __STATIC_INLINE uint32_t RTCC_ChannelTimeGet(
int ch )
398 EFM_ASSERT( RTCC_CH_VALID( ch ) );
399 return RTCC->CC[ ch ].TIME;
412 __STATIC_INLINE
void RTCC_ChannelTimeSet(
int ch, uint32_t time )
414 EFM_ASSERT( RTCC_CH_VALID( ch ) );
415 RTCC->CC[ ch ].TIME = time;
425 __STATIC_INLINE uint32_t RTCC_CombinedCounterGet(
void )
427 return RTCC->COMBCNT;
437 __STATIC_INLINE uint32_t RTCC_CounterGet(
void )
449 __STATIC_INLINE
void RTCC_CounterSet( uint32_t value )
461 __STATIC_INLINE uint32_t RTCC_DateGet(
void )
473 __STATIC_INLINE
void RTCC_DateSet( uint32_t date )
485 __STATIC_INLINE
void RTCC_EM4WakeupEnable(
bool enable )
489 RTCC->EM4WUEN = RTCC_EM4WUEN_EM4WU;
497 void RTCC_Enable(
bool enable );
499 void RTCC_Init(
const RTCC_Init_TypeDef *init );
509 __STATIC_INLINE
void RTCC_IntClear( uint32_t flags )
522 __STATIC_INLINE
void RTCC_IntDisable( uint32_t flags )
540 __STATIC_INLINE
void RTCC_IntEnable( uint32_t flags )
556 __STATIC_INLINE uint32_t RTCC_IntGet(
void )
572 __STATIC_INLINE uint32_t RTCC_IntGetEnabled(
void )
579 return RTCC->IF & tmp;
590 __STATIC_INLINE
void RTCC_IntSet( uint32_t flags )
604 __STATIC_INLINE
void RTCC_Lock(
void )
606 #if defined(ERRATA_FIX_RTCC_E203)
609 uint32_t lfeReg =
CMU->LFECLKEN0;
615 CMU->LFECLKEN0 = 0x0;
617 RTCC->LOCK = RTCC_LOCK_LOCKKEY_LOCK;
618 #if defined(ERRATA_FIX_RTCC_E203)
620 CMU->LFECLKEN0 = lfeReg;
635 __STATIC_INLINE uint32_t RTCC_PreCounterGet(
void )
647 __STATIC_INLINE
void RTCC_PreCounterSet( uint32_t preCntVal )
649 RTCC->PRECNT = preCntVal;
652 void RTCC_Reset(
void );
661 __STATIC_INLINE
void RTCC_RetentionRamPowerDown(
void )
663 #if !defined(ERRATA_FIX_RTCC_E204)
666 RTCC->POWERDOWN = RTCC_POWERDOWN_RAM;
670 void RTCC_StatusClear(
void );
679 __STATIC_INLINE uint32_t RTCC_StatusGet(
void )
681 while ( RTCC->SYNCBUSY & RTCC_SYNCBUSY_CMD )
695 __STATIC_INLINE uint32_t RTCC_TimeGet(
void )
707 __STATIC_INLINE
void RTCC_TimeSet( uint32_t time )
721 __STATIC_INLINE
void RTCC_Unlock(
void )
723 #if defined(ERRATA_FIX_RTCC_E203)
726 uint32_t lfeReg =
CMU->LFECLKEN0;
732 CMU->LFECLKEN0 = 0x0;
734 RTCC->LOCK = RTCC_LOCK_LOCKKEY_UNLOCK;
735 #if defined(ERRATA_FIX_RTCC_E203)
737 CMU->LFECLKEN0 = lfeReg;
Emlib peripheral API "assert" implementation.
CMSIS Cortex-M Peripheral Access Layer for Silicon Laboratories microcontroller devices.
#define CMU_LOCK_LOCKKEY_LOCK
#define CMU_LOCK_LOCKKEY_LOCKED
#define CMU_LOCK_LOCKKEY_UNLOCK