From d95b8610f19ba6b600103149fb8a539fa4c3a03b Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Wed, 14 Sep 2022 14:49:19 +0200 Subject: [PATCH] Fix: No more missing MCP2515 events because the MCP2515 keeps the INT line low UNTIL all EVENTS have been handled. (#162) --- examples/OpenCyphal-Blink/OpenCyphal-Blink.ino | 2 +- examples/OpenCyphal-GNSS-Node/OpenCyphal-GNSS-Node.ino | 2 +- .../OpenCyphal-Heartbeat-Publish.ino | 2 +- .../OpenCyphal-Heartbeat-Subscribe.ino | 2 +- .../OpenCyphal-Service-Client/OpenCyphal-Service-Client.ino | 2 +- .../OpenCyphal-Service-Server/OpenCyphal-Service-Server.ino | 2 +- .../OpenCyphal-ToF-Distance-Sensor-Node.ino | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/OpenCyphal-Blink/OpenCyphal-Blink.ino b/examples/OpenCyphal-Blink/OpenCyphal-Blink.ino index 06e271e3..1a81ec9a 100644 --- a/examples/OpenCyphal-Blink/OpenCyphal-Blink.ino +++ b/examples/OpenCyphal-Blink/OpenCyphal-Blink.ino @@ -97,7 +97,7 @@ void setup() /* Attach interrupt handler to register MCP2515 signaled by taking INT low */ pinMode(MKRCAN_MCP2515_INT_PIN, INPUT_PULLUP); - attachInterrupt(digitalPinToInterrupt(MKRCAN_MCP2515_INT_PIN), []() { mcp2515.onExternalEventHandler(); }, FALLING); + attachInterrupt(digitalPinToInterrupt(MKRCAN_MCP2515_INT_PIN), []() { mcp2515.onExternalEventHandler(); }, LOW); /* Initialize MCP2515 */ mcp2515.begin(); diff --git a/examples/OpenCyphal-GNSS-Node/OpenCyphal-GNSS-Node.ino b/examples/OpenCyphal-GNSS-Node/OpenCyphal-GNSS-Node.ino index fb7e70f8..8ce21660 100644 --- a/examples/OpenCyphal-GNSS-Node/OpenCyphal-GNSS-Node.ino +++ b/examples/OpenCyphal-GNSS-Node/OpenCyphal-GNSS-Node.ino @@ -133,7 +133,7 @@ void setup() * MCP2515 signaled by taking INT low. */ pinMode(MKRCAN_MCP2515_INT_PIN, INPUT_PULLUP); - attachInterrupt(digitalPinToInterrupt(MKRCAN_MCP2515_INT_PIN), []() { mcp2515.onExternalEventHandler(); }, FALLING); + attachInterrupt(digitalPinToInterrupt(MKRCAN_MCP2515_INT_PIN), []() { mcp2515.onExternalEventHandler(); }, LOW); /* Configure MCP2515 */ mcp2515.begin(); diff --git a/examples/OpenCyphal-Heartbeat-Publish/OpenCyphal-Heartbeat-Publish.ino b/examples/OpenCyphal-Heartbeat-Publish/OpenCyphal-Heartbeat-Publish.ino index 28bb248a..ebf69ce3 100644 --- a/examples/OpenCyphal-Heartbeat-Publish/OpenCyphal-Heartbeat-Publish.ino +++ b/examples/OpenCyphal-Heartbeat-Publish/OpenCyphal-Heartbeat-Publish.ino @@ -59,7 +59,7 @@ void setup() /* Attach interrupt handler to register MCP2515 signaled by taking INT low */ pinMode(MKRCAN_MCP2515_INT_PIN, INPUT_PULLUP); - attachInterrupt(digitalPinToInterrupt(MKRCAN_MCP2515_INT_PIN), []() { mcp2515.onExternalEventHandler(); }, FALLING); + attachInterrupt(digitalPinToInterrupt(MKRCAN_MCP2515_INT_PIN), []() { mcp2515.onExternalEventHandler(); }, LOW); /* Initialize MCP2515 */ mcp2515.begin(); diff --git a/examples/OpenCyphal-Heartbeat-Subscribe/OpenCyphal-Heartbeat-Subscribe.ino b/examples/OpenCyphal-Heartbeat-Subscribe/OpenCyphal-Heartbeat-Subscribe.ino index a3f3ef53..3ffb3cfb 100644 --- a/examples/OpenCyphal-Heartbeat-Subscribe/OpenCyphal-Heartbeat-Subscribe.ino +++ b/examples/OpenCyphal-Heartbeat-Subscribe/OpenCyphal-Heartbeat-Subscribe.ino @@ -64,7 +64,7 @@ void setup() /* Attach interrupt handler to register MCP2515 signaled by taking INT low */ pinMode(MKRCAN_MCP2515_INT_PIN, INPUT_PULLUP); - attachInterrupt(digitalPinToInterrupt(MKRCAN_MCP2515_INT_PIN), []() { mcp2515.onExternalEventHandler(); }, FALLING); + attachInterrupt(digitalPinToInterrupt(MKRCAN_MCP2515_INT_PIN), []() { mcp2515.onExternalEventHandler(); }, LOW); /* Initialize MCP2515 */ mcp2515.begin(); diff --git a/examples/OpenCyphal-Service-Client/OpenCyphal-Service-Client.ino b/examples/OpenCyphal-Service-Client/OpenCyphal-Service-Client.ino index 0f952d3a..de809384 100644 --- a/examples/OpenCyphal-Service-Client/OpenCyphal-Service-Client.ino +++ b/examples/OpenCyphal-Service-Client/OpenCyphal-Service-Client.ino @@ -65,7 +65,7 @@ void setup() /* Attach interrupt handler to register MCP2515 signaled by taking INT low */ pinMode(MKRCAN_MCP2515_INT_PIN, INPUT_PULLUP); - attachInterrupt(digitalPinToInterrupt(MKRCAN_MCP2515_INT_PIN), []() { mcp2515.onExternalEventHandler(); }, FALLING); + attachInterrupt(digitalPinToInterrupt(MKRCAN_MCP2515_INT_PIN), []() { mcp2515.onExternalEventHandler(); }, LOW); /* Initialize MCP2515 */ mcp2515.begin(); diff --git a/examples/OpenCyphal-Service-Server/OpenCyphal-Service-Server.ino b/examples/OpenCyphal-Service-Server/OpenCyphal-Service-Server.ino index d496bdb7..bbad8e3b 100644 --- a/examples/OpenCyphal-Service-Server/OpenCyphal-Service-Server.ino +++ b/examples/OpenCyphal-Service-Server/OpenCyphal-Service-Server.ino @@ -65,7 +65,7 @@ void setup() /* Attach interrupt handler to register MCP2515 signaled by taking INT low */ pinMode(MKRCAN_MCP2515_INT_PIN, INPUT_PULLUP); - attachInterrupt(digitalPinToInterrupt(MKRCAN_MCP2515_INT_PIN), []() { mcp2515.onExternalEventHandler(); }, FALLING); + attachInterrupt(digitalPinToInterrupt(MKRCAN_MCP2515_INT_PIN), []() { mcp2515.onExternalEventHandler(); }, LOW); /* Initialize MCP2515 */ mcp2515.begin(); diff --git a/examples/OpenCyphal-ToF-Distance-Sensor-Node/OpenCyphal-ToF-Distance-Sensor-Node.ino b/examples/OpenCyphal-ToF-Distance-Sensor-Node/OpenCyphal-ToF-Distance-Sensor-Node.ino index 5e82b919..bcc43169 100644 --- a/examples/OpenCyphal-ToF-Distance-Sensor-Node/OpenCyphal-ToF-Distance-Sensor-Node.ino +++ b/examples/OpenCyphal-ToF-Distance-Sensor-Node/OpenCyphal-ToF-Distance-Sensor-Node.ino @@ -151,7 +151,7 @@ void setup() * MCP2515 signaled by taking INT low. */ pinMode(MKRCAN_MCP2515_INT_PIN, INPUT_PULLUP); - attachInterrupt(digitalPinToInterrupt(MKRCAN_MCP2515_INT_PIN), []() { mcp2515.onExternalEventHandler(); }, FALLING); + attachInterrupt(digitalPinToInterrupt(MKRCAN_MCP2515_INT_PIN), []() { mcp2515.onExternalEventHandler(); }, LOW); /* Configure MCP2515 */