Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/mcp2515_can.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1058,8 +1058,8 @@ byte mcp2515_can::mcp2515_getNextFreeTXBuf(byte* txbuf_n) { // get
** Function name: begin
** Descriptions: init can and set speed
*********************************************************************************************************/
byte mcp2515_can::begin(uint32_t speedset, const byte clockset) {
pSPI->begin();
byte mcp2515_can::begin(uint32_t speedset, const byte clockset, const bool _initSPI) {
if (_initSPI) pSPI->begin();
byte res = mcp2515_init((byte)speedset, clockset);

return ((res == MCP2515_OK) ? CAN_OK : CAN_FAILINIT);
Expand Down
2 changes: 1 addition & 1 deletion src/mcp2515_can.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class mcp2515_can : public MCP_CAN
{
return MCP_N_TXBUFFERS - 1; // read index of last tx buffer
}
virtual byte begin(uint32_t speedset, const byte clockset = MCP_16MHz); // init can
virtual byte begin(uint32_t speedset, const byte clockset = MCP_16MHz, const bool _initSPI = true); // init can
virtual byte init_Mask(byte num, byte ext, unsigned long ulData); // init Masks
virtual byte init_Filt(byte num, byte ext, unsigned long ulData); // init filters
virtual void setSleepWakeup(byte enable); // Enable or disable the wake up interrupt (If disabled the MCP2515 will not be woken up by CAN bus activity, making it send only)
Expand Down
4 changes: 2 additions & 2 deletions src/mcp2518fd_can.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ uint16_t DRV_CANFDSPI_CalculateCRC16(uint8_t *data, uint16_t size) {
** Function name: begin
** Descriptions: init can and set speed
*********************************************************************************************************/
byte mcp2518fd::begin(uint32_t speedset, const byte clockset) {
SPI.begin();
byte mcp2518fd::begin(uint32_t speedset, const byte clockset, const bool _initSPI) {
if (_initSPI) pSPI->begin();

/* compatible layer translation */
speedset = bittime_compat_to_mcp2518fd(speedset);
Expand Down
3 changes: 2 additions & 1 deletion src/mcp2518fd_can.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ class mcp2518fd : public MCP_CAN {
* or fill by CANFD::BITRATE()
*/
virtual byte begin(uint32_t speedset,
const byte clockset = MCP2518FD_40MHz); // init can
const byte clockset = MCP2518FD_40MHz,
const bool _initSPI = true); // init can
virtual byte init_Mask(byte num, byte ext, unsigned long ulData);
virtual byte init_Filt(byte num, byte ext,
unsigned long ulData); // init filters
Expand Down
2 changes: 1 addition & 1 deletion src/mcp_can.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class MCP_CAN
* speedset be in MCP_BITTIME_SETUP
* clockset be in MCP_CLOCK_T
*/
virtual byte begin(uint32_t speedset, const byte clockset) = 0; // init can
virtual byte begin(uint32_t speedset, const byte clockset, const bool _initSPI = true) = 0; // init can
virtual byte init_Mask(byte num, byte ext, unsigned long ulData) = 0; // init Masks
virtual byte init_Filt(byte num, byte ext, unsigned long ulData) = 0; // init filters
virtual void setSleepWakeup(byte enable) = 0; // Enable or disable the wake up interrupt
Expand Down
Loading