34 #if defined(RTC_COUNT) && (RTC_COUNT > 0)
60 #define RTC_COMP_REG_VALID(reg) (((reg) <= 1))
71 #if defined(_EFM32_GECKO_FAMILY)
87 __STATIC_INLINE
void regSync(uint32_t mask)
91 if (RTC->FREEZE & RTC_FREEZE_REGFREEZE)
96 while (RTC->SYNCBUSY & mask)
117 uint32_t RTC_CompareGet(
unsigned int comp)
121 EFM_ASSERT(RTC_COMP_REG_VALID(comp));
161 void RTC_CompareSet(
unsigned int comp, uint32_t value)
163 volatile uint32_t *compReg;
164 #if defined(_EFM32_GECKO_FAMILY)
168 EFM_ASSERT(RTC_COMP_REG_VALID(comp)
169 && ((value & ~(_RTC_COMP0_COMP0_MASK
170 >> _RTC_COMP0_COMP0_SHIFT)) == 0));
176 compReg = &(RTC->COMP0);
177 #if defined(_EFM32_GECKO_FAMILY)
178 syncbusy = RTC_SYNCBUSY_COMP0;
183 compReg = &(RTC->COMP1);
184 #if defined(_EFM32_GECKO_FAMILY)
185 syncbusy = RTC_SYNCBUSY_COMP1;
193 #if defined(_EFM32_GECKO_FAMILY)
217 void RTC_Enable(
bool enable)
219 #if defined(_EFM32_GECKO_FAMILY)
221 regSync(RTC_SYNCBUSY_CTRL);
226 #if defined(_EFM32_GECKO_FAMILY)
230 regSync(RTC_SYNCBUSY_CTRL);
261 void RTC_FreezeEnable(
bool enable)
265 #if defined(_EFM32_GECKO_FAMILY)
273 while (RTC->SYNCBUSY)
276 RTC->FREEZE = RTC_FREEZE_REGFREEZE;
305 void RTC_Init(
const RTC_Init_TypeDef *init)
322 tmp |= RTC_CTRL_DEBUGRUN;
329 tmp |= RTC_CTRL_COMP0TOP;
332 #if defined(_EFM32_GECKO_FAMILY)
334 regSync(RTC_SYNCBUSY_CTRL);
349 RTC->FREEZE = _RTC_FREEZE_RESETVALUE;
350 RTC->CTRL = _RTC_CTRL_RESETVALUE;
351 RTC->COMP0 = _RTC_COMP0_RESETVALUE;
352 RTC->COMP1 = _RTC_COMP1_RESETVALUE;
353 RTC->IEN = _RTC_IEN_RESETVALUE;
354 RTC->IFC = _RTC_IFC_RESETVALUE;
356 #if defined(_EFM32_GECKO_FAMILY)
360 regSync(RTC_SYNCBUSY_CTRL | RTC_SYNCBUSY_COMP0 | RTC_SYNCBUSY_COMP1);
370 void RTC_CounterReset(
void)
Emlib peripheral API "assert" implementation.
RAM and peripheral bit-field set and clear API.
Real Time Counter (RTC) peripheral API.
__STATIC_INLINE void BUS_RegBitWrite(volatile uint32_t *addr, unsigned int bit, unsigned int val)
Perform a single-bit write operation on a peripheral register.