Skip to content

Commit

Permalink
Move the four-argument sendMsgBuf wrapper to mcp_can.h (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
m516 committed Aug 30, 2022
1 parent b946ae7 commit eb6887b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
5 changes: 1 addition & 4 deletions src/mcp2515_can.h
Expand Up @@ -92,10 +92,7 @@ class mcp2515_can : public MCP_CAN
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
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
virtual byte sendMsgBuf(unsigned long id, byte ext, byte rtrBit, byte len, const byte *buf, bool wait_sent = true); // send buf
/* wrapper */
inline byte sendMsgBuf(unsigned long id, byte ext, byte len, const byte *buf) {
return sendMsgBuf(id, ext, 0, len, buf, true);
}


virtual void clearBufferTransmitIfFlags(byte flags = 0); // Clear transmit flags according to status
virtual byte readRxTxStatus(void); // read has something send or received
Expand Down
5 changes: 1 addition & 4 deletions src/mcp2518fd_can.h
Expand Up @@ -154,10 +154,7 @@ class mcp2518fd : public MCP_CAN {
byte dlc, volatile const byte *buf);
virtual byte sendMsgBuf(unsigned long id, byte ext, byte rtr, byte dlc,
const byte *buf, bool wait_sent = true);
/* wrapper */
inline byte sendMsgBuf(unsigned long id, byte ext, byte len, const byte *buf) {
return sendMsgBuf(id, ext, 0, len, buf, true);
}


virtual void clearBufferTransmitIfFlags(byte flags = 0);
virtual byte readRxTxStatus(void);
Expand Down
6 changes: 5 additions & 1 deletion src/mcp_can.h
Expand Up @@ -94,7 +94,11 @@ class MCP_CAN
byte len, volatile const byte *buf) = 0; // send message buf by using parsed buffer status
virtual byte sendMsgBuf(unsigned long id, byte ext, byte rtrBit,
byte len, const byte *buf, bool wait_sent = true) = 0; // send message with wait

/* wrapper */
inline byte sendMsgBuf(unsigned long id, byte ext, byte len, const byte *buf) {
return sendMsgBuf(id, ext, 0, len, buf, true);
}

virtual void clearBufferTransmitIfFlags(byte flags = 0) = 0; // Clear transmit flags according to status
virtual byte readRxTxStatus(void) = 0; // read has something send or received
virtual byte checkClearRxStatus(byte *status) = 0; // read and clear and return first found rx status bit
Expand Down

0 comments on commit eb6887b

Please sign in to comment.