Added sleep support for MCP2515 + MCP2551. This way, you can reduce the power consumption of a complete node down to around 240uA!
Changes:
- Reintroduced gpio support from commits 43521de/bac66d1 (adlerweb, 15/01/2018) and corrected the errors
- Introduced advanced sleep support based on https://github.com/coryjfowler/MCP_CAN_lib/pull/10/files
- added example code (receive_sleep and send_sleep)
- tested everything
- Backward compatibility should be OK.
- mcp2515_write_canMsg and mcp2515_read_canMsg does transfer now with
single SPI session by using SPI READ RX BUFFER and LOAD TX BUFFER
- mcp2515_start_transmit uses directly SPI instruction RTS
- removed internal data buffer. Read and write uses directly provided
buffer
- works with 8Mhz clock
- Possible to set SPI. Some boards has 2 SPI.
- Works with NMEA2000 library
- New functions for better interrupt handling
The SPISettings object is used to configure the SPI port for your SPI device. All 3 parameters are combined to a single SPISettings object, which is given to SPI.beginTransaction().
Syntax
SPI_BEGIN() --> SPI.beginTransaction(SPISettings(10000000, MSBFIRST, SPI_MODE0))
Stop using the SPI bus. Normally this is called after de-asserting the chip select, to allow other libraries to use the SPI bus.
Syntax
SPI_END() --> SPI.endTransaction()
The original code reads address 0x31, 0x41, or 0x51 "TXBnSIDH – TRANSMIT
BUFFER n STANDARD IDENTIFIER HIGH". Because that location points to a
constant value, some of the msg ids cause the program to loop 50 times
and then report a timeout error. After changing the address to point to
0x30, 0x40, or 0x50 "TXBnCTRL – TRANSMIT BUFFER n CONTROL REGISTER", all
of the messages send out properally with no timeout errors.