diff --git a/README.md b/README.md index ff3a266..c80f3ab 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,7 @@ here are many examples implemented in this library. One of the examples is below #define CAN_31K25BPS 5 #define CAN_33KBPS 6 #define CAN_40KBPS 7 + #define CAN_47K619BPS 19 #define CAN_50KBPS 8 #define CAN_80KBPS 9 #define CAN_83K3BPS 10 diff --git a/examples/recv/recv.ino b/examples/recv/recv.ino index b04126b..66cee03 100644 --- a/examples/recv/recv.ino +++ b/examples/recv/recv.ino @@ -10,6 +10,7 @@ #define CAN_31K25BPS 5 #define CAN_33KBPS 6 #define CAN_40KBPS 7 + #define CAN_47K619BPS 19 #define CAN_50KBPS 8 #define CAN_80KBPS 9 #define CAN_83K3BPS 10 diff --git a/examples/send/send.ino b/examples/send/send.ino index 8788856..b828bc3 100644 --- a/examples/send/send.ino +++ b/examples/send/send.ino @@ -10,6 +10,7 @@ #define CAN_31K25BPS 5 #define CAN_33KBPS 6 #define CAN_40KBPS 7 + #define CAN_47K619BPS 19 #define CAN_50KBPS 8 #define CAN_80KBPS 9 #define CAN_83K3BPS 10 diff --git a/examples/set_mask_filter_recv/set_mask_filter_recv.ino b/examples/set_mask_filter_recv/set_mask_filter_recv.ino index 8845bd6..8033b5e 100644 --- a/examples/set_mask_filter_recv/set_mask_filter_recv.ino +++ b/examples/set_mask_filter_recv/set_mask_filter_recv.ino @@ -10,6 +10,7 @@ #define CAN_31K25BPS 5 #define CAN_33KBPS 6 #define CAN_40KBPS 7 + #define CAN_47K619BPS 19 #define CAN_50KBPS 8 #define CAN_80KBPS 9 #define CAN_83K3BPS 10 @@ -26,10 +27,7 @@ CANBed M0: https://www.longan-labs.cc/1030014.html CAN Bus Shield: https://www.longan-labs.cc/1030016.html OBD-II CAN Bus GPS Dev Kit: https://www.longan-labs.cc/1030003.html - */ -#include -#include "mcp_can.h" #include #include "mcp_can.h" diff --git a/examples/set_mask_filter_send/set_mask_filter_send.ino b/examples/set_mask_filter_send/set_mask_filter_send.ino index a120bac..bee5e98 100644 --- a/examples/set_mask_filter_send/set_mask_filter_send.ino +++ b/examples/set_mask_filter_send/set_mask_filter_send.ino @@ -11,6 +11,7 @@ #define CAN_31K25BPS 5 #define CAN_33KBPS 6 #define CAN_40KBPS 7 + #define CAN_47K619BPS 19 #define CAN_50KBPS 8 #define CAN_80KBPS 9 #define CAN_83K3BPS 10 @@ -26,7 +27,7 @@ CANBed V1: https://www.longan-labs.cc/1030008.html CANBed M0: https://www.longan-labs.cc/1030014.html CAN Bus Shield: https://www.longan-labs.cc/1030016.html - OBD-II CAN Bus GPS Dev Kit: https://www.longan-labs.cc/1030003.html + OBD-II CAN Bus GPS Dev Kit: https://www.longan-labs.cc/1030003.html */ #include diff --git a/keywords.txt b/keywords.txt index 2a13195..7bf55d6 100644 --- a/keywords.txt +++ b/keywords.txt @@ -32,6 +32,7 @@ CAN_25KBPS LITERAL1 CAN_31KBPS LITERAL1 CAN_33KBPS LITERAL1 CAN_40KBPS LITERAL1 +CAN_47K619BPS LITERAL1 CAN_50KBPS LITERAL1 CAN_80KBPS LITERAL1 CAN_83KBPS LITERAL1 diff --git a/mcp_can.cpp b/mcp_can.cpp index 1434405..7a56da6 100644 --- a/mcp_can.cpp +++ b/mcp_can.cpp @@ -273,6 +273,12 @@ byte MCP_CAN::mcp2515_configRate(const byte canSpeed) cfg3 = MCP_16MHz_40kBPS_CFG3; break; + case (CAN_47K619BPS): + cfg1 = MCP_16MHz_47k619BPS_CFG1; + cfg2 = MCP_16MHz_47k619BPS_CFG2; + cfg3 = MCP_16MHz_47k619BPS_CFG3; + break; + case (CAN_50KBPS): cfg1 = MCP_16MHz_50kBPS_CFG1; cfg2 = MCP_16MHz_50kBPS_CFG2; diff --git a/mcp_can_dfs.h b/mcp_can_dfs.h index cbe1df6..d8d6ff2 100644 --- a/mcp_can_dfs.h +++ b/mcp_can_dfs.h @@ -255,6 +255,10 @@ #define MCP_16MHz_50kBPS_CFG2 (0xFA) #define MCP_16MHz_50kBPS_CFG3 (0x87) +#define MCP_16MHz_47k619BPS_CFG1 (0x06) +#define MCP_16MHz_47k619BPS_CFG2 (0xBE) +#define MCP_16MHz_47k619BPS_CFG3 (0x07) + #define MCP_16MHz_40kBPS_CFG1 (0x07) #define MCP_16MHz_40kBPS_CFG2 (0xFF) #define MCP_16MHz_40kBPS_CFG3 (0x87) @@ -326,6 +330,7 @@ #define CAN_31K25BPS 5 #define CAN_33KBPS 6 #define CAN_40KBPS 7 +#define CAN_47K619BPS 19 #define CAN_50KBPS 8 #define CAN_80KBPS 9 #define CAN_83K3BPS 10