From ec36500191d4c6f282ddd7e680b3984ff4935cd7 Mon Sep 17 00:00:00 2001 From: Woodwarth Date: Thu, 2 Nov 2023 16:14:27 +0100 Subject: [PATCH 01/11] CAN Filter and Mask Added CAN Filter and Mask --- .../examples/CANReadFilter/CANReadFilter.ino | 51 +++++++++++++++++++ libraries/Arduino_CAN/src/R7FA4M1_CAN.cpp | 12 +++++ libraries/Arduino_CAN/src/R7FA4M1_CAN.h | 2 + 3 files changed, 65 insertions(+) create mode 100644 libraries/Arduino_CAN/examples/CANReadFilter/CANReadFilter.ino diff --git a/libraries/Arduino_CAN/examples/CANReadFilter/CANReadFilter.ino b/libraries/Arduino_CAN/examples/CANReadFilter/CANReadFilter.ino new file mode 100644 index 00000000..7b1870c7 --- /dev/null +++ b/libraries/Arduino_CAN/examples/CANReadFilter/CANReadFilter.ino @@ -0,0 +1,51 @@ +/* + CANRead + + Receive and read CAN Bus messages + + + Mailbox Groups 0-3 (Mailbox 0-15) -> TRANSMIT + Mailbox Groups 4-5 (Mailbox 16-23) -> RECEIVE EXTENDED + Mailbox Groups 6-7 (Mailbox 24-31) -> RECEIVE STANDARD + + See the full documentation here: + https://docs.arduino.cc/tutorials/uno-r4-wifi/can +*/ + +/************************************************************************************** + * INCLUDE + **************************************************************************************/ + +#include + +/************************************************************************************** + * SETUP/LOOP + **************************************************************************************/ + +void setup() +{ + Serial.begin(115200); + while (!Serial) { } + + CAN.setMailboxMask(4, 0x1FFFFFFF); + CAN.setMailboxMask(6, 0x1FFFFFFF); + + for (int c=16; c <= 31; c++) { + CAN.setMailboxID(c, 0x10); + } + + if (!CAN.begin(CanBitRate::BR_250k)) + { + Serial.println("CAN.begin(...) failed."); + for (;;) {} + } +} + +void loop() +{ + if (CAN.available()) + { + CanMsg const msg = CAN.read(); + Serial.println(msg); + } +} diff --git a/libraries/Arduino_CAN/src/R7FA4M1_CAN.cpp b/libraries/Arduino_CAN/src/R7FA4M1_CAN.cpp index 37e2f6fd..ae8f59f0 100644 --- a/libraries/Arduino_CAN/src/R7FA4M1_CAN.cpp +++ b/libraries/Arduino_CAN/src/R7FA4M1_CAN.cpp @@ -187,6 +187,18 @@ void R7FA4M1_CAN::end() R_CAN_Close(&_can_ctrl); } + +void R7FA4M1_CAN::setMailboxMask(int mailbox_group, uint32_t mask) +{ + _can_mailbox_mask[mailbox_group] = mask; +} + +void R7FA4M1_CAN::setMailboxID(int mailbox, int id) +{ + _can_mailbox[mailbox].mailbox_id = id; +} + + int R7FA4M1_CAN::enableInternalLoopback() { if(fsp_err_t const rc = R_CAN_ModeTransition(&_can_ctrl, CAN_OPERATION_MODE_NORMAL, CAN_TEST_MODE_LOOPBACK_EXTERNAL); rc != FSP_SUCCESS) diff --git a/libraries/Arduino_CAN/src/R7FA4M1_CAN.h b/libraries/Arduino_CAN/src/R7FA4M1_CAN.h index d1ac3517..a4f2b86b 100644 --- a/libraries/Arduino_CAN/src/R7FA4M1_CAN.h +++ b/libraries/Arduino_CAN/src/R7FA4M1_CAN.h @@ -54,6 +54,8 @@ class R7FA4M1_CAN final : public HardwareCAN bool begin(CanBitRate const can_bitrate) override; void end() override; + void setMailboxMask(int mailbox_group,uint32_t mask); + void setMailboxID(int mailbox,int id); int enableInternalLoopback(); int disableInternalLoopback(); From 378a3ce34cdfcaffb9892065e60d130aed8dbd30 Mon Sep 17 00:00:00 2001 From: Woodwarth Date: Fri, 3 Nov 2023 10:06:16 +0100 Subject: [PATCH 02/11] Update CANReadFilter.ino Updated Description --- .../examples/CANReadFilter/CANReadFilter.ino | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/libraries/Arduino_CAN/examples/CANReadFilter/CANReadFilter.ino b/libraries/Arduino_CAN/examples/CANReadFilter/CANReadFilter.ino index 7b1870c7..79b350fc 100644 --- a/libraries/Arduino_CAN/examples/CANReadFilter/CANReadFilter.ino +++ b/libraries/Arduino_CAN/examples/CANReadFilter/CANReadFilter.ino @@ -2,12 +2,17 @@ CANRead Receive and read CAN Bus messages + Read ID 0x100 EXTENDED and ID 0x10 STANDARD Mailbox Groups 0-3 (Mailbox 0-15) -> TRANSMIT Mailbox Groups 4-5 (Mailbox 16-23) -> RECEIVE EXTENDED Mailbox Groups 6-7 (Mailbox 24-31) -> RECEIVE STANDARD + Mailbox Mask 5,7 are preset with 0x1FFFFFFF + Mailbox Mask 4,6 are preset with 0x00 + + See the full documentation here: https://docs.arduino.cc/tutorials/uno-r4-wifi/can */ @@ -18,6 +23,9 @@ #include +#define Mask11Bit 0x1FFC0000 +#define Mask29Bit 0x1FFFFFFF + /************************************************************************************** * SETUP/LOOP **************************************************************************************/ @@ -27,10 +35,14 @@ void setup() Serial.begin(115200); while (!Serial) { } - CAN.setMailboxMask(4, 0x1FFFFFFF); - CAN.setMailboxMask(6, 0x1FFFFFFF); + CAN.setMailboxMask(4, Mask29Bit); + CAN.setMailboxMask(6, Mask11Bit); + + for (int c=16; c <= 23; c++) { + CAN.setMailboxID(c, 0x0100); + } - for (int c=16; c <= 31; c++) { + for (int c=24; c <= 31; c++) { CAN.setMailboxID(c, 0x10); } From c345c88c3655ce2fafb5f381c577b6a3ad181f80 Mon Sep 17 00:00:00 2001 From: Woodwarth Date: Fri, 3 Nov 2023 09:44:47 +0100 Subject: [PATCH 03/11] Update libraries/Arduino_CAN/src/R7FA4M1_CAN.cpp Co-authored-by: Alexander Entinger --- libraries/Arduino_CAN/src/R7FA4M1_CAN.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/Arduino_CAN/src/R7FA4M1_CAN.cpp b/libraries/Arduino_CAN/src/R7FA4M1_CAN.cpp index ae8f59f0..664b3d2d 100644 --- a/libraries/Arduino_CAN/src/R7FA4M1_CAN.cpp +++ b/libraries/Arduino_CAN/src/R7FA4M1_CAN.cpp @@ -188,7 +188,7 @@ void R7FA4M1_CAN::end() } -void R7FA4M1_CAN::setMailboxMask(int mailbox_group, uint32_t mask) +void R7FA4M1_CAN::setMailboxMask(size_t const mailbox_group, uint32_t const mask) { _can_mailbox_mask[mailbox_group] = mask; } From e3303ff165cffd173a3b543febbe79fda6b7673d Mon Sep 17 00:00:00 2001 From: Woodwarth Date: Fri, 3 Nov 2023 09:44:54 +0100 Subject: [PATCH 04/11] Update libraries/Arduino_CAN/src/R7FA4M1_CAN.cpp Co-authored-by: Alexander Entinger --- libraries/Arduino_CAN/src/R7FA4M1_CAN.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/Arduino_CAN/src/R7FA4M1_CAN.cpp b/libraries/Arduino_CAN/src/R7FA4M1_CAN.cpp index 664b3d2d..75ee37a6 100644 --- a/libraries/Arduino_CAN/src/R7FA4M1_CAN.cpp +++ b/libraries/Arduino_CAN/src/R7FA4M1_CAN.cpp @@ -193,7 +193,7 @@ void R7FA4M1_CAN::setMailboxMask(size_t const mailbox_group, uint32_t const mask _can_mailbox_mask[mailbox_group] = mask; } -void R7FA4M1_CAN::setMailboxID(int mailbox, int id) +void R7FA4M1_CAN::setMailboxID(size_t const mailbox, uint32_t const id) { _can_mailbox[mailbox].mailbox_id = id; } From c3cd8ecaa18d76ce6036517e68cbccb17eec0dc4 Mon Sep 17 00:00:00 2001 From: Woodwarth Date: Fri, 3 Nov 2023 09:44:59 +0100 Subject: [PATCH 05/11] Update libraries/Arduino_CAN/src/R7FA4M1_CAN.h Co-authored-by: Alexander Entinger --- libraries/Arduino_CAN/src/R7FA4M1_CAN.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/Arduino_CAN/src/R7FA4M1_CAN.h b/libraries/Arduino_CAN/src/R7FA4M1_CAN.h index a4f2b86b..da1cdeac 100644 --- a/libraries/Arduino_CAN/src/R7FA4M1_CAN.h +++ b/libraries/Arduino_CAN/src/R7FA4M1_CAN.h @@ -54,7 +54,7 @@ class R7FA4M1_CAN final : public HardwareCAN bool begin(CanBitRate const can_bitrate) override; void end() override; - void setMailboxMask(int mailbox_group,uint32_t mask); + void setMailboxMask(size_t const mailbox_group,uint32_t const mask); void setMailboxID(int mailbox,int id); int enableInternalLoopback(); From 649a07cbdea6e0911f01c8f4a87fa53d7a480549 Mon Sep 17 00:00:00 2001 From: Woodwarth Date: Fri, 3 Nov 2023 09:45:05 +0100 Subject: [PATCH 06/11] Update libraries/Arduino_CAN/src/R7FA4M1_CAN.h Co-authored-by: Alexander Entinger --- libraries/Arduino_CAN/src/R7FA4M1_CAN.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/Arduino_CAN/src/R7FA4M1_CAN.h b/libraries/Arduino_CAN/src/R7FA4M1_CAN.h index da1cdeac..fda6483f 100644 --- a/libraries/Arduino_CAN/src/R7FA4M1_CAN.h +++ b/libraries/Arduino_CAN/src/R7FA4M1_CAN.h @@ -55,7 +55,7 @@ class R7FA4M1_CAN final : public HardwareCAN void end() override; void setMailboxMask(size_t const mailbox_group,uint32_t const mask); - void setMailboxID(int mailbox,int id); + void setMailboxID(size_t const mailbox, uint32_t const id); int enableInternalLoopback(); int disableInternalLoopback(); From a56537072191b012b5f075b42d2e5b76d7b195e8 Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Tue, 7 Nov 2023 05:50:17 +0100 Subject: [PATCH 07/11] Instead of relying on the user knowing internals of the CAN library - such as the layout of the mailbox groups - use clearly named methods to help the user achieve the desired outcome. --- .../examples/CANReadFilter/CANReadFilter.ino | 4 ++-- libraries/Arduino_CAN/src/R7FA4M1_CAN.cpp | 11 +++++++++-- libraries/Arduino_CAN/src/R7FA4M1_CAN.h | 3 ++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/libraries/Arduino_CAN/examples/CANReadFilter/CANReadFilter.ino b/libraries/Arduino_CAN/examples/CANReadFilter/CANReadFilter.ino index 79b350fc..9d487c9d 100644 --- a/libraries/Arduino_CAN/examples/CANReadFilter/CANReadFilter.ino +++ b/libraries/Arduino_CAN/examples/CANReadFilter/CANReadFilter.ino @@ -35,8 +35,8 @@ void setup() Serial.begin(115200); while (!Serial) { } - CAN.setMailboxMask(4, Mask29Bit); - CAN.setMailboxMask(6, Mask11Bit); + CAN.setFilterMask_Extended(Mask29Bit); + CAN.setFilterMask_Standard(Mask11Bit); for (int c=16; c <= 23; c++) { CAN.setMailboxID(c, 0x0100); diff --git a/libraries/Arduino_CAN/src/R7FA4M1_CAN.cpp b/libraries/Arduino_CAN/src/R7FA4M1_CAN.cpp index 75ee37a6..83c1a15d 100644 --- a/libraries/Arduino_CAN/src/R7FA4M1_CAN.cpp +++ b/libraries/Arduino_CAN/src/R7FA4M1_CAN.cpp @@ -188,9 +188,16 @@ void R7FA4M1_CAN::end() } -void R7FA4M1_CAN::setMailboxMask(size_t const mailbox_group, uint32_t const mask) +void R7FA4M1_CAN::setFilterMask_Standard(uint32_t const mask) { - _can_mailbox_mask[mailbox_group] = mask; + _can_mailbox_mask[6] = mask; + _can_mailbox_mask[7] = mask; +} + +void R7FA4M1_CAN::setFilterMask_Extended(uint32_t const mask) +{ + _can_mailbox_mask[4] = mask; + _can_mailbox_mask[5] = mask; } void R7FA4M1_CAN::setMailboxID(size_t const mailbox, uint32_t const id) diff --git a/libraries/Arduino_CAN/src/R7FA4M1_CAN.h b/libraries/Arduino_CAN/src/R7FA4M1_CAN.h index fda6483f..8922c73c 100644 --- a/libraries/Arduino_CAN/src/R7FA4M1_CAN.h +++ b/libraries/Arduino_CAN/src/R7FA4M1_CAN.h @@ -54,7 +54,8 @@ class R7FA4M1_CAN final : public HardwareCAN bool begin(CanBitRate const can_bitrate) override; void end() override; - void setMailboxMask(size_t const mailbox_group,uint32_t const mask); + void setFilterMask_Standard(uint32_t const mask); + void setFilterMask_Extended(uint32_t const mask); void setMailboxID(size_t const mailbox, uint32_t const id); int enableInternalLoopback(); From 1808bfa08ba6c644c76d88d04671049096576fee Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Tue, 7 Nov 2023 05:52:11 +0100 Subject: [PATCH 08/11] Replace #define with a constant, use speaking names. --- .../examples/CANReadFilter/CANReadFilter.ino | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/libraries/Arduino_CAN/examples/CANReadFilter/CANReadFilter.ino b/libraries/Arduino_CAN/examples/CANReadFilter/CANReadFilter.ino index 9d487c9d..3b416197 100644 --- a/libraries/Arduino_CAN/examples/CANReadFilter/CANReadFilter.ino +++ b/libraries/Arduino_CAN/examples/CANReadFilter/CANReadFilter.ino @@ -23,8 +23,12 @@ #include -#define Mask11Bit 0x1FFC0000 -#define Mask29Bit 0x1FFFFFFF +/************************************************************************************** + * CONST + **************************************************************************************/ + +static uint32_t const CAN_FILTER_MASK_STANDARD = 0x1FFC0000; +static uint32_t const CAN_FILTER_MASK_EXTENDED = 0x1FFFFFFF; /************************************************************************************** * SETUP/LOOP @@ -35,8 +39,8 @@ void setup() Serial.begin(115200); while (!Serial) { } - CAN.setFilterMask_Extended(Mask29Bit); - CAN.setFilterMask_Standard(Mask11Bit); + CAN.setFilterMask_Extended(CAN_FILTER_MASK_EXTENDED); + CAN.setFilterMask_Standard(CAN_FILTER_MASK_STANDARD); for (int c=16; c <= 23; c++) { CAN.setMailboxID(c, 0x0100); From 432cb04f0bdd0ba33f9041994f1abba82be5df9e Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Tue, 7 Nov 2023 06:09:45 +0100 Subject: [PATCH 09/11] Rewrite filter id to be more convenient and failsafe. --- .../examples/CANReadFilter/CANReadFilter.ino | 10 ++++++---- libraries/Arduino_CAN/src/R7FA4M1_CAN.cpp | 16 ++++++++++++++-- libraries/Arduino_CAN/src/R7FA4M1_CAN.h | 7 ++++++- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/libraries/Arduino_CAN/examples/CANReadFilter/CANReadFilter.ino b/libraries/Arduino_CAN/examples/CANReadFilter/CANReadFilter.ino index 3b416197..f4114881 100644 --- a/libraries/Arduino_CAN/examples/CANReadFilter/CANReadFilter.ino +++ b/libraries/Arduino_CAN/examples/CANReadFilter/CANReadFilter.ino @@ -42,12 +42,14 @@ void setup() CAN.setFilterMask_Extended(CAN_FILTER_MASK_EXTENDED); CAN.setFilterMask_Standard(CAN_FILTER_MASK_STANDARD); - for (int c=16; c <= 23; c++) { - CAN.setMailboxID(c, 0x0100); + for (int mailbox = 0; mailbox < R7FA4M1_CAN::CAN_MAX_EXTENDED_MAILBOXES; mailbox++) + { + CAN.setFilterId_Extended(mailbox, 0x0100); } - for (int c=24; c <= 31; c++) { - CAN.setMailboxID(c, 0x10); + for (int mailbox = 0; mailbox < R7FA4M1_CAN::CAN_MAX_STANDARD_MAILBOXES; mailbox++) + { + CAN.setFilterId_Standard(mailbox, 0x10); } if (!CAN.begin(CanBitRate::BR_250k)) diff --git a/libraries/Arduino_CAN/src/R7FA4M1_CAN.cpp b/libraries/Arduino_CAN/src/R7FA4M1_CAN.cpp index 83c1a15d..726d4ec7 100644 --- a/libraries/Arduino_CAN/src/R7FA4M1_CAN.cpp +++ b/libraries/Arduino_CAN/src/R7FA4M1_CAN.cpp @@ -200,11 +200,23 @@ void R7FA4M1_CAN::setFilterMask_Extended(uint32_t const mask) _can_mailbox_mask[5] = mask; } -void R7FA4M1_CAN::setMailboxID(size_t const mailbox, uint32_t const id) +void R7FA4M1_CAN::setFilterId_Standard(size_t const mailbox, uint32_t const id) { - _can_mailbox[mailbox].mailbox_id = id; + if (mailbox > CAN_MAX_STANDARD_MAILBOXES) + return; + + size_t const mailbox_idx = CAN_MAX_STANDARD_MAILBOX_OFFSET + mailbox; + _can_mailbox[mailbox_idx].mailbox_id = id; } +void R7FA4M1_CAN::setFilterId_Extended(size_t const mailbox, uint32_t const id) +{ + if (mailbox > CAN_MAX_EXTENDED_MAILBOXES) + return; + + size_t const mailbox_idx = CAN_MAX_EXTENDED_MAILBOX_OFFSET + mailbox; + _can_mailbox[mailbox_idx].mailbox_id = id; +} int R7FA4M1_CAN::enableInternalLoopback() { diff --git a/libraries/Arduino_CAN/src/R7FA4M1_CAN.h b/libraries/Arduino_CAN/src/R7FA4M1_CAN.h index 8922c73c..9e20cc36 100644 --- a/libraries/Arduino_CAN/src/R7FA4M1_CAN.h +++ b/libraries/Arduino_CAN/src/R7FA4M1_CAN.h @@ -56,7 +56,8 @@ class R7FA4M1_CAN final : public HardwareCAN void setFilterMask_Standard(uint32_t const mask); void setFilterMask_Extended(uint32_t const mask); - void setMailboxID(size_t const mailbox, uint32_t const id); + void setFilterId_Standard(size_t const mailbox, uint32_t const id); + void setFilterId_Extended(size_t const mailbox, uint32_t const id); int enableInternalLoopback(); int disableInternalLoopback(); @@ -73,9 +74,13 @@ class R7FA4M1_CAN final : public HardwareCAN /* This function is used by the library and should NOT be called by the user. */ void onCanCallback(can_callback_args_t * p_args); + static size_t constexpr CAN_MAX_STANDARD_MAILBOXES = 8U; + static size_t constexpr CAN_MAX_EXTENDED_MAILBOXES = 8U; private: static size_t constexpr CAN_MAX_NO_MAILBOXES = 32U; + static size_t constexpr CAN_MAX_STANDARD_MAILBOX_OFFSET = 24U; + static size_t constexpr CAN_MAX_EXTENDED_MAILBOX_OFFSET = 16U; int const _can_tx_pin; int const _can_rx_pin; From 5ed7c63e5c8e1380a44c2f185405a8d9bb6c9e1c Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Tue, 7 Nov 2023 06:11:00 +0100 Subject: [PATCH 10/11] Add missing NO = Number Of to constant name. --- .../Arduino_CAN/examples/CANReadFilter/CANReadFilter.ino | 4 ++-- libraries/Arduino_CAN/src/R7FA4M1_CAN.cpp | 4 ++-- libraries/Arduino_CAN/src/R7FA4M1_CAN.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libraries/Arduino_CAN/examples/CANReadFilter/CANReadFilter.ino b/libraries/Arduino_CAN/examples/CANReadFilter/CANReadFilter.ino index f4114881..23f9c868 100644 --- a/libraries/Arduino_CAN/examples/CANReadFilter/CANReadFilter.ino +++ b/libraries/Arduino_CAN/examples/CANReadFilter/CANReadFilter.ino @@ -42,12 +42,12 @@ void setup() CAN.setFilterMask_Extended(CAN_FILTER_MASK_EXTENDED); CAN.setFilterMask_Standard(CAN_FILTER_MASK_STANDARD); - for (int mailbox = 0; mailbox < R7FA4M1_CAN::CAN_MAX_EXTENDED_MAILBOXES; mailbox++) + for (int mailbox = 0; mailbox < R7FA4M1_CAN::CAN_MAX_NO_EXTENDED_MAILBOXES; mailbox++) { CAN.setFilterId_Extended(mailbox, 0x0100); } - for (int mailbox = 0; mailbox < R7FA4M1_CAN::CAN_MAX_STANDARD_MAILBOXES; mailbox++) + for (int mailbox = 0; mailbox < R7FA4M1_CAN::CAN_MAX_NO_STANDARD_MAILBOXES; mailbox++) { CAN.setFilterId_Standard(mailbox, 0x10); } diff --git a/libraries/Arduino_CAN/src/R7FA4M1_CAN.cpp b/libraries/Arduino_CAN/src/R7FA4M1_CAN.cpp index 726d4ec7..95938e80 100644 --- a/libraries/Arduino_CAN/src/R7FA4M1_CAN.cpp +++ b/libraries/Arduino_CAN/src/R7FA4M1_CAN.cpp @@ -202,7 +202,7 @@ void R7FA4M1_CAN::setFilterMask_Extended(uint32_t const mask) void R7FA4M1_CAN::setFilterId_Standard(size_t const mailbox, uint32_t const id) { - if (mailbox > CAN_MAX_STANDARD_MAILBOXES) + if (mailbox > CAN_MAX_NO_STANDARD_MAILBOXES) return; size_t const mailbox_idx = CAN_MAX_STANDARD_MAILBOX_OFFSET + mailbox; @@ -211,7 +211,7 @@ void R7FA4M1_CAN::setFilterId_Standard(size_t const mailbox, uint32_t const id) void R7FA4M1_CAN::setFilterId_Extended(size_t const mailbox, uint32_t const id) { - if (mailbox > CAN_MAX_EXTENDED_MAILBOXES) + if (mailbox > CAN_MAX_NO_EXTENDED_MAILBOXES) return; size_t const mailbox_idx = CAN_MAX_EXTENDED_MAILBOX_OFFSET + mailbox; diff --git a/libraries/Arduino_CAN/src/R7FA4M1_CAN.h b/libraries/Arduino_CAN/src/R7FA4M1_CAN.h index 9e20cc36..f60252f6 100644 --- a/libraries/Arduino_CAN/src/R7FA4M1_CAN.h +++ b/libraries/Arduino_CAN/src/R7FA4M1_CAN.h @@ -74,8 +74,8 @@ class R7FA4M1_CAN final : public HardwareCAN /* This function is used by the library and should NOT be called by the user. */ void onCanCallback(can_callback_args_t * p_args); - static size_t constexpr CAN_MAX_STANDARD_MAILBOXES = 8U; - static size_t constexpr CAN_MAX_EXTENDED_MAILBOXES = 8U; + static size_t constexpr CAN_MAX_NO_STANDARD_MAILBOXES = 8U; + static size_t constexpr CAN_MAX_NO_EXTENDED_MAILBOXES = 8U; private: static size_t constexpr CAN_MAX_NO_MAILBOXES = 32U; From 8249937bec2a27e9993a1189e7e0e7455a5503ae Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Tue, 7 Nov 2023 07:28:15 +0100 Subject: [PATCH 11/11] Add newly added methods and constants to keywords.txt for syntax highlighting. --- libraries/Arduino_CAN/keywords.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libraries/Arduino_CAN/keywords.txt b/libraries/Arduino_CAN/keywords.txt index 18ddb001..fd410d9c 100644 --- a/libraries/Arduino_CAN/keywords.txt +++ b/libraries/Arduino_CAN/keywords.txt @@ -26,6 +26,10 @@ available KEYWORD2 read KEYWORD2 isError KEYWORD2 clearError KEYWORD2 +setFilterMask_Standard +setFilterMask_Extended +setFilterId_Standard +setFilterId_Extended getStandardId KEYWORD2 getExtendedId KEYWORD2 @@ -41,3 +45,5 @@ BR_125k LITERAL1 BR_250k LITERAL1 BR_500k LITERAL1 BR_1000k LITERAL1 +CAN_MAX_NO_STANDARD_MAILBOXES LITERAL1 +CAN_MAX_NO_EXTENDED_MAILBOXES LITERAL1