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.
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 00035 00036 00037 // Private functions 00038 private : 00039 uint8_t checkReceive(void); 00040 00041 00042 }; 00043 00044 #endif // _MCP2515_H_
Generated on Mon Sep 26 2022 07:41:12 by
1.7.2