CanBusEnable
Description
This function checks, if a free CAN bus data element is available. If so, this element is initialized as set in the configuration struct of CANBUS_PARA
. If a valid baudrate is configured then the CAN bus driver is used to initialize the CAN bus with the defined baud rate and set the CAN bus in active state. If a invalid baudrate or 0 is configured then this function does return before setting the bus to active state. Therefore the bus is ready for communication.
Prototype
CPU_INT16S CanBusEnable(CANBUS_PARA *cfg);
Parameter | Meaning |
---|---|
| Configuration of bus |
Additional Information
The configured CAN bus controller will be opened with the low level device driver and not closed at the end of the creation. This is done to ensure, that no other function/task tries to use the CAN controller. In other words: this implementation of the CAN bus management needs exclusive access to the CAN controller.
Return Value
One of the following error codes is returned: CAN_ERR_NONE
, CAN_ERR_NULLPTR
, CAN_ERR_BUSID
, CAN_ERR_OPEN
or CAN_ERR_ENABLE
.