GPTM Programming Example
The following example shows how to use the timer API to configure the timer as a half-width one shot timer and a half-width edge capture counter.
/* Configure TimerA as a half-width one-shot timer, and TimerB as a
half-width edge capture counter.
gptm_configure(TIMER0, (TIMER_CFG_SPLIT_PAIR | TIMER_CFG_A_ONE_SHOT | TIMER_CFG_B_CAP_COUNT));
/* Set the count time for the the one-shot timer (TimerA). */
gptm_set_load(TIMER0, TIMER_A, 3000);
/* Configure the counter (TimerB) to count both edges. */
gptm_control_event(TIMER0, TIMER_B, TIMER_EVENT_BOTH_EDGES);
/* Enable the timers. */