Commit Graph
4 Commits
Author SHA1 Message Date
Loovee fec92a1b18 Merge pull request #2 from woodward1/patch-2
Set SPICS pin to output in begin()
2014-03-08 14:47:58 +08:00
woodward1 43d936ddf3 fixed corrupted can id bug
There was an error in the bit arithmatic for the can id.

Basically, if the 15th bit of the id was set, then the upper 16bits were 1 less than they should be.
e.g. 0x0001(8-F)XXX -> 0x0000(8-F)XXX
e.g. 0x0000(8-F)XXX -> 0xFFFF(8-F)XXX

The offending operation is (tbufdata[MCP_EID8]<<8). This promotes an unsigned char to a signed int, which results in the corrupted ids. The fix is to cast it to an unsigned int. Note that int's are 16 bit on avr.
2014-03-07 11:43:52 -08:00
woodward1 705f3be317 Set SPICS pin to output in begin()
It took me a while to figure this out, but the SPICS pin is not necessarily initialized to output when the arduino starts. Explicitly making it an output in the begin() method saves the library user from having to set the pin as output in their code (which they may not know they need to do, since it is not in the example code).
2014-02-28 15:57:16 -08:00
reeedstudio 94edfca904 update 2014-01-02 11:50:38 +08:00