macchina / mcp2515 Goto Github PK
View Code? Open in Web Editor NEWLibrary to facilitate CAN functionality with the onboard MCP2515 CAN controller
License: GNU Lesser General Public License v2.1
Library to facilitate CAN functionality with the onboard MCP2515 CAN controller
License: GNU Lesser General Public License v2.1
In MCP2515::ReadBuffer(), message.extended is set by a bit mask (byte2 & B00001000)
Because CAN_FRAME flags are uint8's, the value '8' is stored, and eventually printed into log files in M2RET, confusing savvyCAN which doesn't interpret the 8 as being true.
I'm sure there's a good reason for this, but why aren't the flags in CAN_FRAME defined as bool?
In any case, this can probably be fixed by casting the bit mask result to a bool before assigning it. We should probably do the same for RTR.
Copy pasted the code exactly to play with and i get these errors. I know it's an old library, but has something changed?
sketch_oct28a:44:1: error: 'Frame' does not name a type
Frame testMessage;
^
C:\Projects\sketch_oct28a\sketch_oct28a.ino: In function 'void setup()':
sketch_oct28a:90:32: error: no matching function for call to 'MCP2515::SetRXMask(int, int, int)'
CAN.SetRXMask(MASK0, 0x7F8, 0); //match all but bottom four bits
^
In file included from C:\Projects\sketch_oct28a\sketch_oct28a.ino:26:0:
C:\Users\ec\Documents\Arduino\libraries\mcp2515-master\src/MCP2515.h:85:7: note: candidate: void MCP2515::SetRXMask(uint8_t, uint32_t)
void SetRXMask(uint8_t mask, uint32_t MaskValue);
^
C:\Users\ec\Documents\Arduino\libraries\mcp2515-master\src/MCP2515.h:85:7: note: candidate expects 2 arguments, 3 provided
sketch_oct28a:100:7: error: 'testMessage' was not declared in this scope
testMessage.id = 0x07DF;
^
C:\Projects\sketch_oct28a\sketch_oct28a.ino: At global scope:
sketch_oct28a:114:1: error: 'Frame' does not name a type
Frame message;
^
C:\Projects\sketch_oct28a\sketch_oct28a.ino: In function 'void loop()':
sketch_oct28a:117:22: error: 'message' was not declared in this scope
if (CAN.GetRXFrame(message)) {
^
sketch_oct28a:31:20: error: 'LED_BUILTIN' was not declared in this scope
#define LED_CAN_TX LED_BUILTIN
^
C:\Projects\sketch_oct28a\sketch_oct28a.ino:144:32: note: in expansion of macro 'LED_CAN_TX'
digitalWrite(LED_CAN_TX, txLEDState);
^
exit status 1
'Frame' does not name a type
This is the only bit of code that I have come across that I know to be targeting the Macchina v1.1 and I know there was some discussion about moving this under the macchina GitHub organization. Asking to know whether it should be clarified this is for an older Macchina product.
If MCP2515::intHandler() is called from an actual interrupt handler while another SPI transfer is in progress, it will try to initiate another SPI transfer, causing one or both transfers to fail.
There are two ways to work around this in client code:
The first method works for me because I am not using any other SPI devices on the bus. If I were, then I would have to also disable interrupts for those operations. The second method works best if the flag can be polled frequently, otherwise received frames might get lost.
I'm not sure what the best solution would be for fixing the library, though.
void MCP2515::SetRXMask(uint8_t mask, uint32_t MaskValue, bool ext)
and
void MCP2515::SetRXFilter(uint8_t filter, uint32_t FilterValue, bool ext)
I could not get filters to work without this change.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.