Provides extra common functions necessary for executing time-based code
CustomTimer is a structure that holds two variables, useful for holding timer logic.
StoredTime - unsigned int - holds the timer start time.
Delay - unsigned int - holds the delay time before the timer finishes.
Wait() is a pause function that executes blocking code. Reads the clock time and waits until the wait time has expired before returning to the parent function. Returns nothing.
dt - type unsigned int - time to pause.
TimerDone() tests whether the CustomTimer has finished. It returns a non-zero unsigned char if finished, and 0 if not.
Timer type CustomTimer holds timer data
CustomTime type unsigned int holds the current time, for evaluating done condition
TimerUpdate () updates Timers internal stored time with CurrentTime, and then returns that Timer.
Timer type CustomTimer holds timer data
CustomTime type unsigned int holds the current time, for updating internal stored time
Create two variables, t0 and t1
Set t0 equal to the current time
Execute the following code:
Set t1 equal to the current time
While the difference between t1 and t0 is less than dt.
If (CurrentTime-StoredTime) is greater than Delay, return 1.
Otherwise return zero
Set Timer.StoredTime equal to CurrentTime
Return the Timer structure.