1.9.22.12 SYSTICK_TimerCallbackSet Function

C

void SYSTICK_TimerCallbackSet ( SYSTICK_CALLBACK callback, uintptr_t context )

Summary

Sets the pointer to the function (and it's context) to be called when the given systick reaches 0.

Description

This function sets the pointer to a client function to be called "back" when systick reaches 0. It also passes a context value (usually a pointer to a context structure) that is passed into the function when it is called.

This function is available only in interrupt or non-blocking mode of operation.

Precondition

SYSTICK_Initialize must have been called for the associated USART instance.

Parameters

Param Description
callback A pointer to a function with a calling signature defined by the SYSTICK_CALLBACK data type.
context A value (usually a pointer) passed (unused) into the function identified by the callback parameter.

Returns

None.

Example

ticks = 0;

void AppCallback ( uintptr_t context )
{
    ticks++;
}

SYSTICK_TimerCallbackSet(AppCallback, (uintptr_t) NULL);

Remarks

The context parameter is ignored if the pointer passed is NULL. To disable the callback function, pass a NULL for the callback parameter.