English
Language : 

UM0459 Datasheet, PDF (19/29 Pages) STMicroelectronics – ST10F27xZx CAN library
UM0459
Controller area network (CAN) routines
2.2.12
2.2.13
CAN_ReleaseMessage function
Table 16. CAN_ReleaseMessage function description
Function name
CAN_ReleaseMessage
Prototype
Behavior description
Input parameter 1
Input parameter 2
Output parameter
Return value
Required preconditions
Called functions
ErrorStatus CAN_ReleaseMessage(CAN_TypeDef* CAN, u16 msgobj);
Releases the message object.
This function searches for a free message interface from IF0 and IF, sets
the ClrIntPnd and TxRqst/NewDat bits in the Command Mask register
and writes the 1+msgobj value to the Command Request register to copy
the selected registers into the message RAM.
CAN: pointer to a CAN1 or CAN2 CAN_TypeDef structure.
msgobj: message object number, from 0 to 31.
None
An ErrorStatus enumeration value:
– SUCCESS: Interface to treat the message
– ERROR: No interface to treat the message
None
CAN_GetFreeIF()
Example:
This example illustrates how to release the message object 0 of CAN2.
{
CAN_ReleaseMessage(CAN2, 0);
}
CAN_SendMessage function
Table 17. CAN_SendMessage function description
Function name
CAN_SendMessage
Prototype
Behavior description
Input parameter 1
Input parameter 2
Input parameter 3
Output parameter
Return value
Required preconditions
Called functions
ErrorStatus CAN_SendMessage(CAN_TypeDef* CAN, u16 msgobj,
canmsg* pCanMsg);
Updates the CAN message object with the pCanMsg fields and starts
the transmission of the message.
CAN: Pointer to a CAN1 or CAN2 CAN_TypeDef structure.
msgobj: message object number, from 0 to 31.
pCanMsg: Pointer to the canmsg structure that contains the data to
transmit: ID type, ID value, data length, data values.
None
An ErrorStatus enumeration value:
– SUCCESS: Transmission started OK
– ERROR: No transmission started
The message object must have been set up properly.
CAN_UpdateMsgObj()
CAN_TransmitRequest()
19/29