9.18 timeout.h File Reference
Includes
- stdint.h
- stdbool.h
- stddef.h
Functions
- void
-
timeout_initialize (void)
This function sets the timeout ISR handler as the the interrupt handler for the timer.
Parameters:
- *timer
- timer instance whose callback have to be called.
Returns:
None
- void
-
timeout_create (timerStruct_t *timer, uint32_t timeout)
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.
Parameters:
- *timer
Type: timerStruct_t *
- timer instance to be created and added to the list
- timeout
Type: uint32_t
- number of timer ticks before this timer expires.
Returns:
None
- void
-
timeout_delete (timerStruct_t *timer)
This function cancels and removes a running timer
Parameters:
- *timer
Type: timerStruct_t *
- timer instance to be removed
Returns:
None
- void
-
timeout_flushAll (void)
This function cancels and removes all timers in the queue
Parameters:
- none
Returns:
None
- bool
-
timeout_hasPendingTimeouts (void)
Call this function to check if there are any timers running or waiting to be called
Parameters:
- none
Returns:
- bool
-
timeout_hasPendingCallbacks (void)
Call this function to check if there are events that are being executed or waiting to be executed
Parameters:
- none
Returns:
- INLINE void
-
timeout_callNextCallback (void)
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.
Parameters:
- none
Returns:
None
- void
-
timeout_isr (void)
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.
Parameters:
- none
Returns:
None
- void
-
timeout_startTimer (timerStruct_t *timer)
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.
Parameters:
- *timer
Type: timerStruct_t *
- timer instance that will be used in stopwatch mode.
Returns:
None
- uint32_t
-
timeout_stopTimer (timerStruct_t *timer)
This function is specifically used in Stopwatch/cycle counter mode. It will stop the running timer and return the number of ticks it counted.
Parameters:
- *timer
Type: timerStruct_t *
- timer instance that is used in stopwatch mode.
Returns:
- uint32_t
-
timeout_getTimeRemaining (timerStruct_t *timer)
This function gets the number of ticks remaining before a specific timer runs out.
Parameters:
- *timer
Type: timerStruct_t *
- the specific timer in question
Returns: