General-Purpose Timer Function Documentation

 

Sys_Timer_Config

void Sys_Timer_Config(TIMER_Type * timer, uint32_t cfg0, uint32_t cfg1, uint32_t timeout)

 

Configure timer instance.

 

Location: timer.h:51

 

Parameters

Direction Name Description

in

timer

Pointer to the timer instance

in

cfg0

Timer configuration 0; use TIMER_PRESCALE_*,

in

cfg1

Timer configuration 1; use TIMER_MULTI_COUNT_* [TIMER_SHOT_MODE | TIMER_FREE_RUN]

in

timeout

number of timer clock cycles before a timeout would occur

 

 

Example Code for Sys_Timer_Config

    // Configure TIMER2 instance:

    //  - Divide the input clock frequency by 2

    //  - Stop on 2nd Time-out occurrence and issue an interrupt

    //  - Select the GPIO interrupt defined in GPIO_INT_CFG3

    //  - GPIO interrupt single capture mode

    //  - Free-run mode

    //  - Long timeout

    Sys_Timer_Config(TIMER2, TIMER_PRESCALE_2,

                     TIMER_MULTI_COUNT_2 |

                     TIMER_SRC_GPIO_INT3  |

                     TIMER_GPIO_INT_SINGLE |

                     TIMER_FREE_RUN, 0xFFFF);

 

Sys_Timer_Start

void Sys_Timer_Start(TIMER_Type * timer)

 

Start or restart timer instance.

 

Location: timer.h:65

 

Parameters

Direction Name Description

in

timer

Pointer to the timer instance

 

 

Example Code for Sys_Timer_Start

    // Start or restart TIMER instance

    Sys_Timer_Start(TIMER);

 

Sys_Timer_Stop

void Sys_Timer_Stop(TIMER_Type * timer)

 

Stop the timer instance.

 

Location: timer.h:76

 

Parameters

Direction Name Description

in

timer

Pointer to the timer instance

 

 

Example Code for Sys_Timer_Stop

    // Stop the TIMER3 instance

    Sys_Timer_Stop(TIMER3);