Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mcp2515 by
CAN3.h
00001 00002 #ifndef _CAN3_H_ 00003 #define _CAN3_H_ 00004 00005 #include "mbed.h" 00006 #include "mcp2515.h" 00007 #include "mcp2515_defs.h" 00008 #include "mcp2515_can.h" 00009 #include "SPI.h" 00010 00011 #define BFPCTRL 0x0C 00012 #define TXRTSCTRL 0x0D 00013 00014 00015 class CAN3 { 00016 SPI& spi; 00017 //InterruptIn _itr; 00018 mcp2515 _mcp; 00019 public: 00020 CAN3(SPI& _spi, PinName ncs);//, PinName itr); 00021 00022 uint8_t read(CANMessage *msg); // int read(CANMessage& msg); 00023 void write(CANMessage* test); //int write(CANMessage msg); 00024 int frequency( int canSpeed); //Set the frequency of the CAN interface hz The bus frequency in hertz 00025 00026 00027 void reset(); //Reset CAN interface. To use after error overflow. 00028 unsigned char rderror(); //Returns number of read errors to detect read overflow errors. 00029 unsigned char tderror(); //Returns number of write errors to detect write overflow errors. 00030 00031 void rise(void (*fptr)(void)); 00032 void fall(void (*fptr2)(void)); 00033 00034 // Private functions 00035 private : 00036 uint8_t checkReceive(void); 00037 00038 00039 }; 00040 00041 #endif // _CAN3_H_
Generated on Tue Jul 12 2022 22:54:58 by
1.7.2
