I'm trying to create a simple countdown timer (without using interrupts) - to use to check for timeout while waiting for an external event to occur.
Ideally, I'd like to preload a timer counter with a specific value and have it count down and stop once it gets to zero - so that I can poll for a zero counter value in my while loop.
I'm struggling to get the timer to run, and none of the examples I can see in the reference manual is this simple.
Can anyone point me towards a simple example of a one shot countdown timer implementation?
if (timer == 0 || timer > START_VALUE) { ...}
? \$\endgroup\$