3.1.7 PAL_TimerStop Function

C

PAL_Status_t PAL_TimerStop(TimerId_t timerId)

Summary

Stops a running timer

Description

This function stops a running timer with specified timer_id

Precondition

Timer should have been started before using this function

Parameters

timerId - Timer identifier

Returns

PAL_TMR_INVALID_ID - if the timer identifier is undefined

PAL_SUCCESS - if timer is stopped successfully

Example

PAL_Status_t retVal = PAL_FAILURE;
TimerId_t appTimer;

static void AppTimerCallback(void *paramCb)
{
    //Toggle LED
}

//Get the Id for the sotware timer instance
PAL_TimerGetId(&appTimer);

if (PAL_SUCCESS == PAL_TimerStart(appTimer,
5000,
TIMEOUT_RELATIVE,
(void *)AppTimerCallback,
NULL, CALLBACK_SINGLE))
{
    //Timer Started
    //ToggleLED
}

if (PAL_SUCCESS == PAL_TimerStop(appTimer))
{
    //Timer Stopped
    //ToggleLED
}

Remarks

Timer should be started before stopping it