void timer_init(void)
{
NRF_TIMER2->TASKS_STOP = 1; // Stop timer
NRF_TIMER2->MODE = TIMER_MODE_MODE_Timer;
NRF_TIMER2->BITMODE = (TIMER_BITMODE_BITMODE_24Bit << TIMER_BITMODE_BITMODE_Pos);
NRF_TIMER2->PRESCALER = 8; // 1us resolution
NRF_TIMER2->TASKS_CLEAR = 1; // Clear timer
NRF_TIMER2->CC[0] = 500000; // should be 1 second
NRF_TIMER2->INTENSET = TIMER_INTENSET_COMPARE0_Enabled << TIMER_INTENSET_COMPARE0_Pos;
NRF_TIMER2->SHORTS = (TIMER_SHORTS_COMPARE0_CLEAR_Enabled << TIMER_SHORTS_COMPARE0_CLEAR_Pos);
NVIC_EnableIRQ(TIMER2_IRQn);
NRF_TIMER2->TASKS_START = 1; // Start TIMER
}
void TIMER2_IRQHandler(void)
{
if(NRF_TIMER2->EVENTS_COMPARE[0] != 0)
{
NRF_TIMER2->EVENTS_COMPARE[0] = 0;
NRF_TIMER2->CC[0] += 500000;
m_timer_counter++;
}
}
I am trying to have an interrupt that would allow ESB RF to change so I could essentially scan several channels for broadcasts. However I can not get the above code to work. I have the interval large for now, but I can not even set a breakpoint in the interrupt handler. I started with the ESB RX example and added the above code.