I'm trying to monitor the time a signal is high/low on a GPIO. It seems to work alright with timers and PPI, but I wish there was a way to reset the timer upon capture.
This is what I have:
uint32_t ppi_event_addr = nrf_drv_gpiote_in_event_addr_get(IR_PIN);
err_code = nrf_drv_ppi_channel_alloc(&ppi_channel1);
APP_ERROR_CHECK(err_code);
err_code = nrf_drv_ppi_channel_assign(ppi_channel1, ppi_event_addr,nrf_drv_timer_task_address_get(&timer_freq, NRF_TIMER_TASK_CAPTURE1));
APP_ERROR_CHECK(err_code);
It captures the timer value, which I then can read out in the GIOTE handler. But it keeps on counting up - it'd be nice to have the timer reset automatically to 0.