5.2 Real Time Counter Driver Example Source Code Reference

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

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

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

There are three 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 rtcounter_example.h header file in whichever file the RTCounter_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.