Hello everybody,
I'm trying to use the RTC1 in the LedButtonDemo, in order to blink the led once we put 01 in with the Master Control Panel on my computer, but all my tempos doesn't work.
Here is my code concerning the RTC (which works on the Blinky Example) :
void rtcInit(void)
{
NRF_CLOCK->LFCLKSRC = CLOCK_LFCLKSRC_SRC_Xtal << CLOCK_LFCLKSRC_SRC_Pos;
NRF_CLOCK->EVENTS_LFCLKSTARTED = 0
NRF_CLOCK->TASKS_LFCLKSTART = 1;
while(NRF_CLOCK->EVENTS_LFCLKSTARTED == 0);
NRF_RTC1->PRESCALER = 0;
NRF_RTC0->PRESCALER = 0;
}
void WAIT_MSz(int ms)
{
NRF_RTC1->EVTENSET = RTC_EVTEN_COMPARE0_Msk;
NRF_RTC1->INTENSET = RTC_INTENSET_COMPARE0_Msk;
NRF_RTC1->CC[0] = ms*33;
NVIC_EnableIRQ(RTC1_IRQn);
NRF_RTC1->TASKS_START = 1;
__SEV();
__WFE();
__WFE();
}
void RTC1_IRQHandler(void)
{
if(NRF_RTC1->EVENTS_COMPARE[0])
{
NRF_RTC1->EVENTS_COMPARE[0] = 0;
NRF_RTC1->TASKS_CLEAR = 1;
}
}
Is there an error in my code, or is it due to the fact that the LedButtonDemo use the RTC1, as this example use the Scheduler ?
Thank's in advance for helping me !