mirror of
https://github.com/Seeed-Studio/Seeed_Arduino_CAN.git
synced 2026-07-28 04:06:45 +00:00
Applied changes to base on latest Seeed version
- Backward compatibility should be OK. - mcp2515_write_canMsg and mcp2515_read_canMsg does transfer now with single SPI session by using SPI READ RX BUFFER and LOAD TX BUFFER - mcp2515_start_transmit uses directly SPI instruction RTS - removed internal data buffer. Read and write uses directly provided buffer - works with 8Mhz clock - Possible to set SPI. Some boards has 2 SPI. - Works with NMEA2000 library - New functions for better interrupt handling
This commit is contained in:
@@ -54,7 +54,7 @@
|
||||
class MCP_CAN
|
||||
{
|
||||
private:
|
||||
|
||||
|
||||
byte ext_flg; // identifier xxxID
|
||||
// either extended (the 29 LSB) or standard (the 11 LSB)
|
||||
unsigned long can_id; // can id
|
||||
@@ -72,7 +72,7 @@ private:
|
||||
void mcp2515_reset(void); // reset mcp2515
|
||||
|
||||
byte mcp2515_readRegister(const byte address); // read mcp2515's register
|
||||
|
||||
|
||||
void mcp2515_readRegisterS(const byte address,
|
||||
byte values[],
|
||||
const byte n);
|
||||
@@ -82,9 +82,9 @@ private:
|
||||
void mcp2515_setRegisterS(const byte address, // set mcp2515's registers
|
||||
const byte values[],
|
||||
const byte n);
|
||||
|
||||
|
||||
void mcp2515_initCANBuffers(void);
|
||||
|
||||
|
||||
void mcp2515_modifyRegister(const byte address, // set bit of one register
|
||||
const byte mask,
|
||||
const byte data);
|
||||
@@ -119,9 +119,9 @@ public:
|
||||
void init_CS(byte _CS); // define CS after construction before begin()
|
||||
void setSPI(SPIClass *_pSPI) { pSPI=_pSPI; } // define SPI port to use before begin()
|
||||
void enableTxInterrupt(bool enable=true); // enable transmit interrupt
|
||||
void reserveTxBuffers(byte nTxBuf=0) { nReservedTx=(nTxBuf<MCP_N_TXBUFFERS?nTxBuf:MCP_N_TXBUFFERS-1); }
|
||||
void reserveTxBuffers(byte nTxBuf=0) { nReservedTx=(nTxBuf<MCP_N_TXBUFFERS?nTxBuf:MCP_N_TXBUFFERS-1); }
|
||||
byte getLastTxBuffer() { return MCP_N_TXBUFFERS-1; } // read index of last tx buffer
|
||||
|
||||
|
||||
byte begin(byte speedset, const byte clockset = MCP_16MHz); // init can
|
||||
byte init_Mask(byte num, byte ext, unsigned long ulData); // init Masks
|
||||
byte init_Filt(byte num, byte ext, unsigned long ulData); // init filters
|
||||
@@ -148,7 +148,7 @@ public:
|
||||
byte readRxTxStatus(void); // read has something send or received
|
||||
byte checkClearRxStatus(byte *status); // read and clear and return first found rx status bit
|
||||
byte checkClearTxStatus(byte *status, byte iTxBuf=0xff); // read and clear and return first found or buffer specified tx status bit
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user