SiLabs Pearl: lpticker wakeup

pull/1501/head
jhokajar 2015-11-04 16:54:18 +02:00 committed by Steven Cooreman
parent a31071275a
commit 22879f972d
2 changed files with 8 additions and 3 deletions

View File

@ -157,6 +157,9 @@ void lp_ticker_set_interrupt(timestamp_t timestamp)
/* check for RTCC limitation */
if((timestamp_ticks - RTCC_CounterGet()) >= 0x80000000) timestamp_ticks = RTCC_CounterGet() + 2;
/* init channel */
RTCC_CCChConf_TypeDef ccchConf = RTCC_CH_INIT_COMPARE_DEFAULT;
RTCC_ChannelInit(0,&ccchConf);
/* Set callback */
RTCC_ChannelCCVSet(0, (uint32_t)timestamp_ticks);
RTCC_IntEnable(RTCC_IF_CC0);

View File

@ -192,14 +192,16 @@ void rtc_init_real(uint32_t flags)
/* Enable clock to the interface of the low energy modules */
CMU_ClockEnable(cmuClock_CORELE, true);
/* Scale clock to save power */
CMU_ClockDivSet(cmuClock_RTCC, RTC_CLOCKDIV);
/* Initialize RTC */
RTCC_Init_TypeDef init = RTCC_INIT_DEFAULT;
init.enable = 1;
init.precntWrapOnCCV0 = false;
init.cntWrapOnCCV1 = false;
#if RTC_CLOCKDIV_INT == 8
init.presc = rtccCntPresc_8;
#else
#error invalid prescaler value RTC_CLOCKDIV_INT
#endif
/* Enable Interrupt from RTC */
RTCC_IntEnable(RTCC_IEN_OF);