Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add timing for 47k619bps #26

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions examples/recv/recv.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions examples/send/send.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions examples/set_mask_filter_recv/set_mask_filter_recv.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 <SPI.h>
#include "mcp_can.h"

#include <SPI.h>
#include "mcp_can.h"
Expand Down
3 changes: 2 additions & 1 deletion examples/set_mask_filter_send/set_mask_filter_send.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 <mcp_can.h>
Expand Down
1 change: 1 addition & 0 deletions keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions mcp_can.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions mcp_can_dfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down