1.25.3.19 CANx_RxCallbackRegister Function

C

bool CANx_RxCallbackRegister(CAN_CALLBACK callback, uintptr_t contextHandle, CAN_MAILBOX_RX_ATTRIBUTE mailboxAttr) // x - Instance of the CAN peripheral

Summary

Sets the pointer to the function (and it's context) to be called when the given CAN's Rx transfer events occur.

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 CAN_CALLBACK data type.
contextHandle A value (usually a pointer) passed (unused) into the functionidentified by the callback parameter.
mailboxAttr Mailbox type either RX Mailbox or RX Mailbox with overwrite

Returns

Request status. true - Request was successful.

false - Request has failed.

Example

void CAN0_callbackHandler (uintptr_t context)
{
}
CAN0_RxCallbackRegister(CAN0_callbackHandler, 0, CAN_MAILBOX_DATA_FRAME_RX_OVERWRITE);
CAN0_MessageReceive(&rx_messageID, &rx_messageLength, rx_message, &timestamp, CAN_MAILBOX_DATA_FRAME_RX_OVERWRITE);

Remarks

None.