Simple timer as counter

Hello,

I want to use app_simple_timer as a counter - I am trying to access the current number of ticks at regular intervals, something in the style of what was suggested here (see also pasted code below).

Is there a straightforward way of doing this with the simple timer or should I try to implement it manually through nrf_drv_timer?

Thank you

 

uint32_t   current_counter = 0;
 NRF_TIMER1->TASKS_CAPTURE[2] = 1;  // This is asking to capture the current counter into CC[2]
current_counter = NRF_TIMER1->CC[2];   // counter value  at the instant when capture task was triggered is now ready to be read in CC[2]

Related