25 static void (*rtcCb)(void);
26 static uint8_t rtcInitialized = 0;
27 static volatile bool rtcDelayComplete;
28 static uint32_t rtcFreq;
33 static void DelayCB(
void)
35 rtcDelayComplete =
true;
49 RTC_Init_TypeDef init;
68 init.debugRun =
false;
69 init.comp0Top =
false;
73 RTC_IntDisable(_RTC_IF_MASK);
76 NVIC_ClearPendingIRQ(RTC_IRQn);
77 NVIC_EnableIRQ(RTC_IRQn);
87 rtcDelayComplete =
false;
88 RTCDRV_Trigger(msec, DelayCB);
90 while (!rtcDelayComplete)
102 void RTC_IRQHandler(
void)
108 RTC_IntClear(RTC_IF_COMP0);
111 RTC_IntDisable(RTC_IF_COMP0);
126 void RTCDRV_Trigger(uint32_t msec,
void (*cb)(
void))
142 RTC_IntClear(RTC_IF_COMP0);
145 RTC_CompareSet(0, (rtcFreq * msec) / 1000);
151 RTC_IntEnable(RTC_IF_COMP0);
Clock management unit (CMU) API.
void CMU_ClockSelectSet(CMU_Clock_TypeDef clock, CMU_Select_TypeDef ref)
Select reference clock/oscillator used for a clock branch.
void EMU_EnterEM2(bool restore)
Enter energy mode 2 (EM2).
CMSIS Cortex-M Peripheral Access Layer for Silicon Laboratories microcontroller devices.
uint32_t CMU_ClkDiv_TypeDef
Real Time Counter (RTC) driver prototypes and definitions.
Ecode_t RTCDRV_Delay(uint32_t ms)
Millisecond delay function.
void CMU_ClockEnable(CMU_Clock_TypeDef clock, bool enable)
Enable/disable a clock.
Real Time Counter (RTC) peripheral API.
Energy management unit (EMU) peripheral API.
uint32_t CMU_ClockFreqGet(CMU_Clock_TypeDef clock)
Get clock frequency for a clock point.
void CMU_ClockDivSet(CMU_Clock_TypeDef clock, CMU_ClkDiv_TypeDef div)
Set clock divisor/prescaler.