Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed X_NUCLEO_PLC01A1 ros_lib_melodic
can_controller.cpp
- Committer:
- yamadola
- Date:
- 2020-08-08
- Revision:
- 0:43eb9ccc1583
- Child:
- 1:ef4b86795d79
File content as of revision 0:43eb9ccc1583:
#include "can_controller.h"
/**
* @brief Initialize CAN controller
* @param None
*/
CANController::CANController()
:can1(MBED_CONF_APP_CAN1_RD, MBED_CONF_APP_CAN1_TD)
{}
/**
* @brief Send CAN message
* @param ID: CAN ID of the target device
* @param msgData: Address of the message data to be sent
* @retval 0: Transmission is successful, -1:Transmission is failed
*/
int CANController::sendMessage( uint16_t ID, char *msgData ){
CANMessage msg(ID, msgData, 8, CANData, CANStandard);
int successFlag = can1.write(msg);
if(successFlag){
return 0;
}else{
return -1;
}
}