Your approach is basically a reciprocal counter and it can work, if you start and stop the timer in the isr. The logic is essentially this: If timer is on stop the timer and save the timer count. Else initialize the timer and start counting. For counting a wide range of frequencies, you may need to consider timer over flow.