Skip to content

Commit 6dcfabc

Browse files
authored
Patch four-argument sendmsgbuf (#146)
maintains backward compatibility with previous versions of the function call
1 parent 02d18fb commit 6dcfabc

File tree

10 files changed

+15
-14
lines changed

10 files changed

+15
-14
lines changed

examples/OBDII_PIDs/OBDII_PIDs.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ void sendPid(unsigned char __pid) {
8080
unsigned char tmp[8] = {0x02, 0x01, __pid, 0, 0, 0, 0, 0};
8181
SERIAL_PORT_MONITOR.print("SEND PID: 0x");
8282
SERIAL_PORT_MONITOR.println(__pid, HEX);
83-
CAN.MCP_CAN::sendMsgBuf(CAN_ID_PID, 0, 8, tmp);
83+
CAN.sendMsgBuf(CAN_ID_PID, 0, 8, tmp);
8484
}
8585

8686
void setup() {

examples/send/send.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
#include <SPI.h>
66

7-
#define CAN_2515
8-
// #define CAN_2518FD
7+
//#define CAN_2515
8+
#define CAN_2518FD
99

1010
// Set SPI CS Pin according to your hardware
1111

@@ -61,7 +61,7 @@ void loop() {
6161
}
6262
}
6363

64-
CAN.MCP_CAN::sendMsgBuf(0x00, 0, 8, stmp);
64+
CAN.sendMsgBuf(0x00, 0, 8, stmp);
6565
delay(100); // send data per 100ms
6666
SERIAL_PORT_MONITOR.println("CAN BUS sendMsgBuf ok!");
6767
}

examples/sendFD/sendFD.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void loop() {
5454
}
5555
}
5656

57-
CAN.MCP_CAN::sendMsgBuf(0x00, 0, CANFD::len2dlc(MAX_DATA_SIZE), stmp);
57+
CAN.sendMsgBuf(0x00, 0, CANFD::len2dlc(MAX_DATA_SIZE), stmp);
5858
delay(100); // send data per 100ms
5959
SERIAL_PORT_MONITOR.println("CAN BUS sendMsgBuf ok!");
6060
}

examples/send_Blink/send_Blink.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// demo: CAN-BUS Shield, send data
22
#include <SPI.h>
33

4-
#define CAN_2515
5-
// #define CAN_2518FD
4+
//#define CAN_2515
5+
#define CAN_2518FD
66

77
// Set SPI CS Pin according to your hardware
88

@@ -52,7 +52,7 @@ unsigned char stmp[8] = {ledHIGH, 1, 2, 3, ledLOW, 5, 6, 7};
5252
void loop() {
5353
SERIAL_PORT_MONITOR.println("In loop");
5454
// send data: id = 0x70, standard frame, data len = 8, stmp: data buf
55-
CAN.MCP_CAN::sendMsgBuf(0x70, 0, 8, stmp);
55+
CAN.sendMsgBuf(0x70, 0, 8, stmp);
5656
delay(1000); // send data once per second
5757
}
5858

examples/send_Blink_ROS/send_Blink_ROS.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ mcp2515_can CAN(SPI_CS_PIN); // Set CS pin
2626
void messageCb(const std_msgs::Empty& toggle_msg) {
2727
//digitalWrite(13, HIGH-digitalRead(13)); // blink the led
2828
// send data: id = 0x00, standrad frame, data len = 8, stmp: data buf
29-
CAN.MCP_CAN::sendMsgBuf(0x70, 0, 8, stmp);
29+
CAN.sendMsgBuf(0x70, 0, 8, stmp);
3030
delay(1000); // send data per 100ms
3131
}
3232

examples/send_sleep/send_sleep.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ unsigned char stmp[8] = {0, 0, 0, 0, 0, 0, 0, 0};
8383
void loop() {
8484
SERIAL_PORT_MONITOR.println("Sending message");
8585

86-
CAN.MCP_CAN::sendMsgBuf(0x00, 0, 0, NULL); // Send empty wakeup message
86+
CAN.sendMsgBuf(0x00, 0, 0, NULL); // Send empty wakeup message
8787

8888
delay(100); // give the receiving node some time to wake up
8989

@@ -100,7 +100,7 @@ void loop() {
100100
}
101101
}
102102

103-
CAN.MCP_CAN::sendMsgBuf(0x00, 0, 8, stmp);
103+
CAN.sendMsgBuf(0x00, 0, 8, stmp);
104104

105105

106106
// sleep

examples/set_mask_filter_send/set_mask_filter_send.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ unsigned char stmp[8] = {0, 1, 2, 3, 4, 5, 6, 7};
5151
void loop() {
5252
for (int id = 0; id < 10; id++) {
5353
memset(stmp, id, sizeof(stmp)); // set id to send data buff
54-
CAN.MCP_CAN::sendMsgBuf(id, 0, sizeof(stmp), stmp);
54+
CAN.sendMsgBuf(id, 0, sizeof(stmp), stmp);
5555
delay(100);
5656
}
5757
}

src/can-serial.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ class Can232
211211
INT8U openCanBus();
212212

213213
INT8U sendMsgBuf(INT32U id, INT8U ext, INT8U rtr, INT8U len, INT8U *buf);
214-
214+
215215
void parseCanStdId();
216216
void parseCanExtId();
217217
};

src/mcp2515_can.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class mcp2515_can : public MCP_CAN
9292
virtual byte trySendMsgBuf(unsigned long id, byte ext, byte rtrBit, byte len, const byte *buf, byte iTxBuf = 0xff); // as sendMsgBuf, but does not have any wait for free buffer
9393
virtual byte sendMsgBuf(byte status, unsigned long id, byte ext, byte rtrBit, byte len, volatile const byte *buf); // send message buf by using parsed buffer status
9494
virtual byte sendMsgBuf(unsigned long id, byte ext, byte rtrBit, byte len, const byte *buf, bool wait_sent = true); // send buf
95-
95+
using MCP_CAN::sendMsgBuf; // make other overloads visible
9696

9797
virtual void clearBufferTransmitIfFlags(byte flags = 0); // Clear transmit flags according to status
9898
virtual byte readRxTxStatus(void); // read has something send or received

src/mcp2518fd_can.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ class mcp2518fd : public MCP_CAN {
154154
byte dlc, volatile const byte *buf);
155155
virtual byte sendMsgBuf(unsigned long id, byte ext, byte rtr, byte dlc,
156156
const byte *buf, bool wait_sent = true);
157+
using MCP_CAN::sendMsgBuf; // make other overloads visible
157158

158159

159160
virtual void clearBufferTransmitIfFlags(byte flags = 0);

0 commit comments

Comments
 (0)