File tree Expand file tree Collapse file tree 3 files changed +14
-17
lines changed Expand file tree Collapse file tree 3 files changed +14
-17
lines changed Original file line number Diff line number Diff line change 44#ifndef CAN_H
55#define CAN_H
66
7+
78#ifdef ARDUINO_ARCH_ESP32
8- #include "ESP32SJA1000.h"
9- #else
10- #include "MCP2515.h"
9+ //#include "ESP32SJA1000.h"
10+ #ifndef ESP32_EXTERNAL_CAN
11+ //#define IGNORE_MCP2515
12+ #endif
1113#endif
1214
15+ #include "MCP2515.h"
16+
1317#endif
Original file line number Diff line number Diff line change 11// Copyright (c) Sandeep Mistry. All rights reserved.
22// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33
4- #ifndef ARDUINO_ARCH_ESP32
4+ #ifndef IGNORE_MCP2515
55
66#include " MCP2515.h"
77
@@ -328,15 +328,16 @@ int MCP2515Class::parsePacket()
328328 return _rxDlc;
329329}
330330
331+
331332void MCP2515Class::onReceive (void (*callback)(int ))
332333{
333334 CANControllerClass::onReceive (callback);
334335
335336 pinMode (_intPin, INPUT);
336337
337338 if (callback) {
338- SPI.usingInterrupt (digitalPinToInterrupt (_intPin));
339- attachInterrupt (digitalPinToInterrupt (_intPin), MCP2515Class::onInterrupt, LOW);
339+ // SPI.usingInterrupt(digitalPinToInterrupt(_intPin));
340+ // attachInterrupt(digitalPinToInterrupt(_intPin), MCP2515Class::onInterrupt, LOW);
340341 } else {
341342 detachInterrupt (digitalPinToInterrupt (_intPin));
342343#ifdef SPI_HAS_NOTUSINGINTERRUPT
@@ -345,6 +346,7 @@ void MCP2515Class::onReceive(void(*callback)(int))
345346 }
346347}
347348
349+
348350int MCP2515Class::filter (int id, int mask)
349351{
350352 id &= 0x7ff ;
@@ -705,11 +707,5 @@ void MCP2515Class::writeRegister(uint8_t address, uint8_t value)
705707 SPI.endTransaction ();
706708}
707709
708- void MCP2515Class::onInterrupt ()
709- {
710- CAN.handleInterrupt ();
711- }
712-
713- MCP2515Class CAN;
714710
715711#endif
Original file line number Diff line number Diff line change 11// Copyright (c) Sandeep Mistry. All rights reserved.
22// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33
4- #ifndef ARDUINO_ARCH_ESP32
4+ // #ifndef IGNORE_MCP2515
55
66#ifndef MCP2515_H
77#define MCP2515_H
@@ -81,17 +81,14 @@ class MCP2515Class : public CANControllerClass {
8181 void modifyRegister (uint8_t address, uint8_t mask, uint8_t value);
8282 void writeRegister (uint8_t address, uint8_t value);
8383
84- static void onInterrupt ();
85-
8684private:
8785 SPISettings _spiSettings;
8886 int _csPin;
8987 int _intPin;
9088 long _clockFrequency;
9189};
9290
93- extern MCP2515Class CAN;
9491
9592#endif
9693
97- #endif
94+ // #endif
You can’t perform that action at this time.
0 commit comments