34 #if defined(RTC_COUNT) && (RTC_COUNT > 0)
57 #define RTC_COMP_REG_VALID(reg) (((reg) <= 1))
68 #if defined(_EFM32_GECKO_FAMILY)
84 __STATIC_INLINE
void regSync(uint32_t mask)
88 if (RTC->FREEZE & RTC_FREEZE_REGFREEZE)
93 while (RTC->SYNCBUSY & mask)
114 uint32_t RTC_CompareGet(
unsigned int comp)
118 EFM_ASSERT(RTC_COMP_REG_VALID(comp));
158 void RTC_CompareSet(
unsigned int comp, uint32_t value)
160 volatile uint32_t *compReg;
161 #if defined(_EFM32_GECKO_FAMILY)
165 EFM_ASSERT(RTC_COMP_REG_VALID(comp)
166 && ((value & ~(_RTC_COMP0_COMP0_MASK
167 >> _RTC_COMP0_COMP0_SHIFT)) == 0));
173 compReg = &(RTC->COMP0);
174 #if defined(_EFM32_GECKO_FAMILY)
175 syncbusy = RTC_SYNCBUSY_COMP0;
180 compReg = &(RTC->COMP1);
181 #if defined(_EFM32_GECKO_FAMILY)
182 syncbusy = RTC_SYNCBUSY_COMP1;
190 #if defined(_EFM32_GECKO_FAMILY)
214 void RTC_Enable(
bool enable)
216 #if defined(_EFM32_GECKO_FAMILY)
218 regSync(RTC_SYNCBUSY_CTRL);
223 #if defined(_EFM32_GECKO_FAMILY)
227 regSync(RTC_SYNCBUSY_CTRL);
258 void RTC_FreezeEnable(
bool enable)
262 #if defined(_EFM32_GECKO_FAMILY)
270 while (RTC->SYNCBUSY)
273 RTC->FREEZE = RTC_FREEZE_REGFREEZE;
302 void RTC_Init(
const RTC_Init_TypeDef *init)
319 tmp |= RTC_CTRL_DEBUGRUN;
326 tmp |= RTC_CTRL_COMP0TOP;
329 #if defined(_EFM32_GECKO_FAMILY)
331 regSync(RTC_SYNCBUSY_CTRL);
346 RTC->FREEZE = _RTC_FREEZE_RESETVALUE;
347 RTC->CTRL = _RTC_CTRL_RESETVALUE;
348 RTC->COMP0 = _RTC_COMP0_RESETVALUE;
349 RTC->COMP1 = _RTC_COMP1_RESETVALUE;
350 RTC->IEN = _RTC_IEN_RESETVALUE;
351 RTC->IFC = _RTC_IFC_RESETVALUE;
353 #if defined(_EFM32_GECKO_FAMILY)
357 regSync(RTC_SYNCBUSY_CTRL | RTC_SYNCBUSY_COMP0 | RTC_SYNCBUSY_COMP1);
367 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.