timeout_hasPendingTimeouts
Call this function to check if there are any timers running or waiting to be called
timeout_hasPendingCallbacks
Call this function to check if there are events that are being executed or waiting to be executed
stopTimeouts
This function disables all the timers without deleting them from the list. Timers can be restarted by calling startTimerAtHead
setTimerDuration
This sets the number of ticks the timer will run for.
makeAbsolute
This function takes a number of ticks and returns the total number of timer ticks since the last timeout occurred or the timer module was started.
timeout_getTimeRemaining
This function gets the number of ticks remaining before a specific timer runs out.
rebaseList
This function adjusts the time base so that the timer can never wrap
printList
This function prints the times for each of the timer for each timer on the queue.
sortedInsert
This function figures out where the specific timer will be placed on the queue.
startTimerAtHead
This function starts the timer queue from the beginning.
timeout_flushAll
This function cancels and removes all timers in the queue
timeout_deleteHelper
This function looks for a specific timer instance and removes it from the queue.
timeout_delete
This function cancels and removes a running timer
enqueueCallback
This function moves a specific timer from the active list to the list of timers which are expired and needs their callbacks called in callNextCallback
timeout_callNextCallback
This function checks the list of expired timers and calls the first one in the list if the list is not empty. It also reschedules the timer if the callback returned a value greater than 0.It is recommended this is called from the main superloop (while(1)) in your code but by design this can also be called from the timer ISR. If you wish callbacks to happen from the ISR context you can call this as the last action in timeout_isr instead.
timeout_initialize
This function sets the timeout ISR handler as the the interrupt handler for the timer.
timeout_create
This function adds to the queue and starts the timer. If the timer was already active/running it will be replaced by this and the old (active) timer will be removed/cancelled first.
timeout_isr
This function is the handler that is called whenever the Timer peripheral interrupts. The handler counts the time elapsed and calls the next timer in the queue. It assumes that the callback is completed before the next timer tick.
timeout_startTimer
This function is specifically used in Stopwatch/cycle counter mode. It will start a timer with maximum timeout of up to the maximum range of the timer divided by 2.
timeout_stopTimer
This function is specifically used in Stopwatch/cycle counter mode. It will stop the running timer and return the number of ticks it counted.