Jump to main content

##

# 2.8.45 CANx_ErrorCallbackRegister Function

## C

The prototype of CANx_ErrorCallbackRegister() varies based on device family. Refer to the generated header file for the actual prototype to be used.

    void CANx_ErrorCallbackRegister(CAN_CALLBACK callback, uintptr_t contextHandle) // x - Instance of the CAN peripheral

    void CANx_ErrorCallbackRegister(CANFD_CALLBACK callback, uintptr_t contextHandle) // x - Instance of the CAN peripheral

## Summary

Sets the pointer to the function (and it's context) to be called when error occurs in CAN.

## Description

This routine sets the pointer to the function (and it's context) to be called when error occurs in CAN.

## Precondition

CANx_Initialize must have been called for the associated CAN instance.

## Parameters

Param | Description
--- | ---
callback | A pointer to a function with a calling signature definedby the callback data type.
contextHandle | A value (usually a pointer) passed (unused) into the functionidentified by the callback parameter.

## Returns

None.

## Example

    void APP_CAN_ErrorCallback (uintptr_t context)
    {
    }
    CAN1_ErrorCallbackRegister( APP_CAN_ErrorCallback, (uintptr_t)APP_STATE_CAN_XFER_ERROR);

## Remarks

None.