I want to measure how long a signal is high as accurately as possible (preferably down to the microsecond). I started by triggering an EXTI interrupt one both the rising and falling edge of the signal. The EXTI handler would check if the signal is high or low. If high, it would start a timer, and if low it would end it and return how long the timer was active. I tried to implement this with SysTick but I fear it is not accurate enough. I thought about using a TIM but I don't know how to return how long the timer was running... Any advice?