Jump to main content

##

# 2.120.2.19 TCx_CHy_CompareCallbackRegister Function

## C

    /* x = TC instance number, y= channel number */
    void TCx_CHy_CompareCallbackRegister ( TC_COMPARE_CALLBACK callback, uintptr_t context )

## Summary

Registers the function to be called from interrupt.

## Description

This function registers the callback function to be called from interrupt

## Precondition

TCx_CHy_CompareInitialize must have been called first.

## Parameters

Param | Description
--- | ---
callback | Callback function pointer.
context | Value provided back to the caller by the callback (usually a pointer to the caller's context for multi-instance clients).

## Returns

None.

## Example

    void TC_CallbackFn(TC_COMPARE_STATUS status, uintptr_t context);

    TC0_CH1_CompareInitialize();
    TC0_CH1_CompareCallbackRegister(TC_CallbackFn, NULL);

## Remarks

Context value can be set to NULL if not required. To disable callback function, pass NULL for the callback parameter.