mirror of
https://github.com/Seeed-Studio/Seeed_Arduino_CAN.git
synced 2026-07-27 19:55:59 +00:00
Merge pull request #65 from ntb001/master
Allow for extended CAN IDs in the example programs
This commit is contained in:
+131
@@ -0,0 +1,131 @@
|
||||
## WINDOWS
|
||||
# Windows thumbnail cache files
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
ehthumbs_vista.db
|
||||
|
||||
# Dump file
|
||||
*.stackdump
|
||||
|
||||
# Folder config file
|
||||
[Dd]esktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Windows Installer files
|
||||
*.cab
|
||||
*.msi
|
||||
*.msix
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# Windows shortcuts
|
||||
*.lnk
|
||||
|
||||
## MAC OS
|
||||
# General
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Icon must end with two \r
|
||||
Icon
|
||||
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
# Files that might appear in the root of a volume
|
||||
.DocumentRevisions-V100
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
.com.apple.timemachine.donotpresent
|
||||
|
||||
# Directories potentially created on remote AFP share
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
|
||||
## DROPBOX
|
||||
# Dropbox settings and caches
|
||||
.dropbox
|
||||
.dropbox.attr
|
||||
.dropbox.cache
|
||||
|
||||
## VS CODE
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
|
||||
## VIM
|
||||
# Swap
|
||||
[._]*.s[a-v][a-z]
|
||||
[._]*.sw[a-p]
|
||||
[._]s[a-v][a-z]
|
||||
[._]sw[a-p]
|
||||
|
||||
# Session
|
||||
Session.vim
|
||||
|
||||
# Temporary
|
||||
.netrwhist
|
||||
*~
|
||||
# Auto-generated tag files
|
||||
tags
|
||||
# Persistent undo
|
||||
[._]*.un~
|
||||
|
||||
## EMACS
|
||||
# -*- mode: gitignore; -*-
|
||||
*~
|
||||
\#*\#
|
||||
/.emacs.desktop
|
||||
/.emacs.desktop.lock
|
||||
*.elc
|
||||
auto-save-list
|
||||
tramp
|
||||
.\#*
|
||||
|
||||
# Org-mode
|
||||
.org-id-locations
|
||||
*_archive
|
||||
|
||||
# flymake-mode
|
||||
*_flymake.*
|
||||
|
||||
# eshell files
|
||||
/eshell/history
|
||||
/eshell/lastdir
|
||||
|
||||
# elpa packages
|
||||
/elpa/
|
||||
|
||||
# reftex files
|
||||
*.rel
|
||||
|
||||
# AUCTeX auto folder
|
||||
/auto/
|
||||
|
||||
# cask packages
|
||||
.cask/
|
||||
dist/
|
||||
|
||||
# Flycheck
|
||||
flycheck_*.el
|
||||
|
||||
# server auth directory
|
||||
/server/
|
||||
|
||||
# projectiles files
|
||||
.projectile
|
||||
|
||||
# directory configuration
|
||||
.dir-locals.el
|
||||
@@ -145,7 +145,7 @@ When frame is received you may check whether it was remote request and whether i
|
||||
|
||||
<br>
|
||||
|
||||
For more information, please refer to [wiki page](http://www.seeedstudio.com/wiki/CAN-BUS_Shield).
|
||||
For more information, please refer to [wiki page](http://wiki.seeedstudio.com/CAN-BUS_Shield_V2.0/).
|
||||
|
||||
|
||||
----
|
||||
@@ -165,4 +165,3 @@ global distributors and partners to push open hardware movement.<br>
|
||||
|
||||
|
||||
[](https://github.com/igrigorik/ga-beacon)
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ void taskCanRecv()
|
||||
CAN.readMsgBuf(&len, buf); // read data, len: data length, buf: data buf
|
||||
|
||||
Serial.println("\r\n------------------------------------------------------------------");
|
||||
Serial.print("Get Data From id: ");
|
||||
Serial.print("Get Data From id: 0x");
|
||||
Serial.println(CAN.getCanId(), HEX);
|
||||
for(int i = 0; i<len; i++) // print the data
|
||||
{
|
||||
|
||||
@@ -37,11 +37,11 @@ void loop()
|
||||
{
|
||||
CAN.readMsgBuf(&len, buf); // read data, len: data length, buf: data buf
|
||||
|
||||
unsigned char canId = CAN.getCanId();
|
||||
unsigned long canId = CAN.getCanId();
|
||||
|
||||
Serial.println("-----------------------------");
|
||||
Serial.println("get data from ID: ");
|
||||
Serial.println(canId);
|
||||
Serial.println("get data from ID: 0x");
|
||||
Serial.println(canId, HEX);
|
||||
|
||||
for(int i = 0; i<len; i++) // print the data
|
||||
{
|
||||
|
||||
@@ -36,10 +36,10 @@ void loop()
|
||||
{
|
||||
CAN.readMsgBuf(&len, buf); // read data, len: data length, buf: data buf
|
||||
|
||||
unsigned int canId = CAN.getCanId();
|
||||
unsigned long canId = CAN.getCanId();
|
||||
|
||||
Serial.println("-----------------------------");
|
||||
Serial.print("Get data from ID: ");
|
||||
Serial.print("Get data from ID: 0x");
|
||||
Serial.println(canId, HEX);
|
||||
|
||||
for(int i = 0; i<len; i++) // print the data
|
||||
|
||||
@@ -27,8 +27,8 @@ unsigned char stmp[8] = {ledHIGH, 1, 2, 3, ledLOW, 5, 6, 7};
|
||||
|
||||
void loop()
|
||||
{ Serial.println("In loop");
|
||||
// send data: id = 0x00, standard frame, data len = 8, stmp: data buf
|
||||
CAN.sendMsgBuf(0x70,0, 8, stmp);
|
||||
// send data: id = 0x70, standard frame, data len = 8, stmp: data buf
|
||||
CAN.sendMsgBuf(0x70, 0, 8, stmp);
|
||||
delay(1000); // send data once per second
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -776,10 +776,8 @@ void MCP_CAN::mcp2515_read_canMsg( const byte buffer_load_addr, volatile unsigne
|
||||
// mcp2515 has auto-increment of address-pointer
|
||||
for (i = 0; i < 4; i++) tbufdata[i] = spi_read();
|
||||
|
||||
*rtrBit=(tbufdata[3]&0x08 ? 1 : 0 );
|
||||
|
||||
*id = (tbufdata[MCP_SIDH] << 3) + (tbufdata[MCP_SIDL] >> 5);
|
||||
|
||||
*ext = 0;
|
||||
if ( (tbufdata[MCP_SIDL] & MCP_TXB_EXIDE_M) == MCP_TXB_EXIDE_M )
|
||||
{
|
||||
/* extended id */
|
||||
@@ -789,7 +787,9 @@ void MCP_CAN::mcp2515_read_canMsg( const byte buffer_load_addr, volatile unsigne
|
||||
*ext = 1;
|
||||
}
|
||||
|
||||
*len=spi_read() & MCP_DLC_MASK;
|
||||
byte pMsgSize = spi_read();
|
||||
*len = pMsgSize & MCP_DLC_MASK;
|
||||
*rtrBit = (pMsgSize & MCP_RTR_MASK) ? 1 : 0;
|
||||
for (i = 0; i < *len && i<CAN_MAX_CHAR_IN_MESSAGE; i++) {
|
||||
buf[i] = spi_read();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user