WPILibC++  unspecified
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
CANInterfacePlugin.h
1 // CANInterfacePlugin.h
2 //
3 // Defines the API for building a CAN Interface Plugin to support
4 // PWM-cable-free CAN motor control on FRC robots. This allows you
5 // to connect any CAN interface to the secure Jaguar CAN driver.
6 //
7 
8 #ifndef __CANInterfacePlugin_h__
9 #define __CANInterfacePlugin_h__
10 
11 #include <stdint.h>
12 
13 #define CAN_IS_FRAME_REMOTE 0x80000000
14 #define CAN_IS_FRAME_11BIT 0x40000000
15 #define CAN_29BIT_MESSAGE_ID_MASK 0x1FFFFFFF
16 #define CAN_11BIT_MESSAGE_ID_MASK 0x000007FF
17 
19  public:
21  virtual ~CANInterfacePlugin() {}
22 
38  virtual int32_t sendMessage(uint32_t messageID, const uint8_t *data,
39  uint8_t dataSize) = 0;
40 
64  virtual int32_t receiveMessage(uint32_t &messageID, uint8_t *data,
65  uint8_t &dataSize) = 0;
66 
67 #if defined(__linux)
68 
90  virtual int32_t getStatus(uint32_t &busOffCount, uint32_t &txFullCount,
91  uint32_t &receiveErrorCount,
92  uint32_t &transmitErrorCount) {
93  return 0;
94  }
95 #endif
96 };
97 
106 void FRC_NetworkCommunication_CANSessionMux_registerInterface(
107  CANInterfacePlugin *interface);
108 
109 #endif // __CANInterfacePlugin_h__
virtual int32_t receiveMessage(uint32_t &messageID, uint8_t *data, uint8_t &dataSize)=0
This entry-point of the CANInterfacePlugin is passed buffers which should be populated with any recei...
virtual int32_t sendMessage(uint32_t messageID, const uint8_t *data, uint8_t dataSize)=0
This entry-point of the CANInterfacePlugin is passed a message that the driver needs to send to a dev...
Definition: CANInterfacePlugin.h:18