2.8.83 CANx_TxCallbackRegister Function

C

bool CANx_TxCallbackRegister(CAN_CALLBACK callback, uintptr_t contextHandle, CAN_MAILBOX_TX_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 Tx transfer events occur.

Precondition

CANx_Initialize must have been called for the associated CAN instance.

Parameters

ParamDescription
callbackA pointer to a function with a calling signature definedby the CAN_CALLBACK data type.
contextHandleA value (usually a pointer) passed (unused) into the functionidentified by the callback parameter.
mailboxAttrMailbox type TX Mailbox or Consumer Mailbox or Producer Mailbox

Returns

Request status. true - Request was successful.

false - Request has failed.

Example

void CAN0_callbackHandler (uintptr_t context)
{
}
CAN0_TxCallbackRegister(CAN0_callbackHandler, 0, CAN_MAILBOX_DATA_FRAME_TX);
CAN0_MessageTransmit(messageID, messageLength, message, CAN_MAILBOX_DATA_FRAME_TX);

Remarks

None.