7.2 Timeout Driver Example Source Code Reference

This file contains the APIs to demonstrate the common use cases of the Timeout Driver.

This file contains sample source codes to demonstrate the common use cases if the Timeout Driver.

For the examples to run, the user must only need to select which timer the Timeout driver will be used and configure the selected timer.

There are three possible use cases in this example:
  1. Oneshot Timer - After adding an event to the handler such as a pulse or an LED toggle, calling this example will run the the timer and execute the event exactly once.
  2. Periodic Timer - After adding an event to the handler such as a pulse or an LED toggle, calling this example will run the the timer and execute the event repeatedly.
  3. Stopwatch/Counter - Calling this example will run the the timer and return the number of timer ticks that has elapsed while a loop is executing.
Important Notes:
  1. Include the timeout_example.h header file in whichever file the Timeout_example_create_<mode>() functions will be called.
  2. If using MCC-generated GPIO operations and macros within the callbacks, make sure to include pin_manager.h (i.e. #include "../include/pin_manager.h")
  3. If using interrupt-driven timers, make sure global interrupts are enabled.