43 #ifndef _MLAB_CANDEFS_H_ 44 #define _MLAB_CANDEFS_H_ 52 namespace mira {
namespace can {
95 #define CAN_MAX_STANDARD_ID 0x7ff // 11 bits 96 #define CAN_MAX_EXTENDED_ID 0x1fffffff // 29 bits 98 #define CAN_MSG_TYPE_STANDARD 0x00 // a standard frame 99 #define CAN_MSG_TYPE_RTR 0x01 // a remote frame 100 #define CAN_MSG_TYPE_EXTENDED 0x02 // an extended frame 111 template<
typename Reflector>
114 r.member(
"ID",
id,
"11/29 bit identifier");
115 r.member(
"Type",
type,
"CAN message type");
116 r.member(
"Length",
len,
"Number of data bytes (0..8)");
117 r.member(
"Data",
data,
"Data - Up to 8 data bytes");
124 memset(&
data, 0x00, 8);
140 template<
typename Reflector>
143 r.member(
"ErrorRegister",
errorRegister,
"One byte error register");
144 r.member(
"ErrorCode",
errorCode,
"16 bit error code");
146 "Up to 5 data bytes manufacturer specific error information");
CANBaudRate
An enum of the different CAN baud rates.
Definition: CANDefs.h:59
Overrun in receive buffer.
Definition: CANDefs.h:80
busoff
Definition: CANDefs.h:84
The receive queue is overrun.
Definition: CANDefs.h:81
No error.
Definition: CANDefs.h:77
An unknown error.
Definition: CANDefs.h:85
The transmit buffer is full.
Definition: CANDefs.h:78
void reflect(Reflector &r)
Definition: CANDefs.h:112
buslight
Definition: CANDefs.h:82
CANEmergencyMessage()
Definition: CANDefs.h:149
20 kBit/s
Definition: CANDefs.h:66
busheavy
Definition: CANDefs.h:83
50 kBit/s
Definition: CANDefs.h:65
A definition of a CAN emergency message.
Definition: CANDefs.h:135
uint8 len
number of data bytes (0...8)
Definition: CANDefs.h:108
The transmit queue is full.
Definition: CANDefs.h:79
5 kBit/s
Definition: CANDefs.h:68
uint8 specific[5]
Up to 5 data bytes manufacturer specific error information.
Definition: CANDefs.h:138
#define MLAB_CAN_EXPORT
Definition: CANExports.h:57
CANStatusFlags
CAN status enum definitions.
Definition: CANDefs.h:76
uint8 type
CAN_MSG_TYPE_*.
Definition: CANDefs.h:107
CAN export macro declaration.
#define CAN_MSG_TYPE_STANDARD
Definition: CANDefs.h:98
uint8 data[8]
up to 8 data bytes
Definition: CANDefs.h:109
100 kBit/s
Definition: CANDefs.h:64
10 kBit/s
Definition: CANDefs.h:67
125 kBit/s
Definition: CANDefs.h:63
MLAB_CAN_EXPORT std::string convertCANStatus2String(CANStatusFlags)
Convert a CANStatusFlag into a human-readable message.
void reflect(Reflector &r)
Definition: CANDefs.h:141
uint16 errorCode
16 bit emergency error code
Definition: CANDefs.h:137
A definition of a CAN message.
Definition: CANDefs.h:105
CANMessage()
The constructor for this struct.
Definition: CANDefs.h:121
MIRA_ENUM_TO_FLAGS(CANStatusFlags)
1 MBit/s
Definition: CANDefs.h:60
500 kBit/s
Definition: CANDefs.h:61
250 kBit/s
Definition: CANDefs.h:62
uint8 errorRegister
One byte error register (Object 1001h of the local object dictionary)
Definition: CANDefs.h:136
uint32 id
11/29 bit identifier
Definition: CANDefs.h:106