Add unsigned everywhere in the driver for

compatibility with the CAN HAL
pull/9111/head
embeddedteam103 2018-12-16 16:50:13 +02:00 committed by CoolUsername
parent 463a4536e2
commit 0210cefa9e
1 changed files with 7 additions and 7 deletions

View File

@ -41,10 +41,10 @@ public:
*/ */
CANMessage() : CAN_Message() CANMessage() : CAN_Message()
{ {
len = 8; len = 8U;
type = CANData; type = CANData;
format = CANStandard; format = CANStandard;
id = 0; id = 0U;
memset(data, 0, 8); memset(data, 0, 8);
} }
@ -56,7 +56,7 @@ public:
* @param _type Type of Data: Use enum CANType for valid parameter values * @param _type Type of Data: Use enum CANType for valid parameter values
* @param _format Data Format: Use enum CANFormat for valid parameter values * @param _format Data Format: Use enum CANFormat for valid parameter values
*/ */
CANMessage(unsigned _id, const char *_data, char _len = 8, CANType _type = CANData, CANFormat _format = CANStandard) CANMessage(unsigned int _id, const unsigned char *_data, unsigned char _len = 8, CANType _type = CANData, CANFormat _format = CANStandard)
{ {
len = _len & 0xF; len = _len & 0xF;
type = _type; type = _type;
@ -70,7 +70,7 @@ public:
* @param _id Message ID * @param _id Message ID
* @param _format Data Format: Use enum CANType for valid parameter values * @param _format Data Format: Use enum CANType for valid parameter values
*/ */
CANMessage(unsigned _id, CANFormat _format = CANStandard) CANMessage(unsigned int _id, CANFormat _format = CANStandard)
{ {
len = 0; len = 0;
type = CANRemote; type = CANRemote;
@ -104,10 +104,10 @@ public:
* CAN can1(MBED_CONF_APP_CAN1_RD, MBED_CONF_APP_CAN1_TD); * CAN can1(MBED_CONF_APP_CAN1_RD, MBED_CONF_APP_CAN1_TD);
* CAN can2(MBED_CONF_APP_CAN2_RD, MBED_CONF_APP_CAN2_TD); * CAN can2(MBED_CONF_APP_CAN2_RD, MBED_CONF_APP_CAN2_TD);
* *
* char counter = 0; * unsigned char counter = 0;
* *
* void send() { * void send() {
* if(can1.write(CANMessage(1337, &counter, 1))) { * if(can1.write(CANMessage(1337U, &counter, 1))) {
* printf("Message sent: %d\n", counter); * printf("Message sent: %d\n", counter);
* counter++; * counter++;
* } * }
@ -116,7 +116,7 @@ public:
* *
* int main() { * int main() {
* ticker.attach(&send, 1); * ticker.attach(&send, 1);
* CANMessage msg; * CANMessage msg;
* while(1) { * while(1) {
* if(can2.read(msg)) { * if(can2.read(msg)) {
* printf("Message received: %d\n\n", msg.data[0]); * printf("Message received: %d\n\n", msg.data[0]);