aa
CANMsg.h@5:4f03cb1e882b, 2021-09-01 (annotated)
- Committer:
- kurobikari
- Date:
- Wed Sep 01 02:56:41 2021 +0000
- Revision:
- 5:4f03cb1e882b
- Parent:
- 4:5017a65ff423
fia
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hudakz | 1:34738eb16cf7 | 1 | #ifndef CANMSG_H |
hudakz | 1:34738eb16cf7 | 2 | #define CANMSG_H |
hudakz | 0:3d11ed680b6a | 3 | |
hudakz | 0:3d11ed680b6a | 4 | #include "CAN.h" |
hudakz | 0:3d11ed680b6a | 5 | |
hudakz | 4:5017a65ff423 | 6 | class CANMsg : public mbed::CANMessage |
hudakz | 0:3d11ed680b6a | 7 | { |
hudakz | 0:3d11ed680b6a | 8 | public: |
hudakz | 0:3d11ed680b6a | 9 | /** Creates empty CAN message. |
hudakz | 0:3d11ed680b6a | 10 | */ |
hudakz | 0:3d11ed680b6a | 11 | CANMsg() : |
kurobikari | 5:4f03cb1e882b | 12 | CANMessage() { } |
hudakz | 0:3d11ed680b6a | 13 | |
hudakz | 0:3d11ed680b6a | 14 | /** Creates CAN message with specific content. |
hudakz | 0:3d11ed680b6a | 15 | */ |
hudakz | 0:3d11ed680b6a | 16 | CANMsg(int _id, const char *_data, char _len = 8, CANType _type = CANData, CANFormat _format = CANStandard) : |
kurobikari | 5:4f03cb1e882b | 17 | CANMessage(_id, _data, _len, _type, _format) { } |
hudakz | 0:3d11ed680b6a | 18 | |
hudakz | 0:3d11ed680b6a | 19 | /** Creates CAN remote message. |
hudakz | 0:3d11ed680b6a | 20 | */ |
hudakz | 0:3d11ed680b6a | 21 | CANMsg(int _id, CANFormat _format = CANStandard) : |
kurobikari | 5:4f03cb1e882b | 22 | CANMessage(_id, _format) { } |
hudakz | 0:3d11ed680b6a | 23 | |
hudakz | 0:3d11ed680b6a | 24 | /** Clears CAN message content |
hudakz | 0:3d11ed680b6a | 25 | */ |
kurobikari | 5:4f03cb1e882b | 26 | void clear(void) |
kurobikari | 5:4f03cb1e882b | 27 | { |
hudakz | 0:3d11ed680b6a | 28 | len = 0; |
hudakz | 0:3d11ed680b6a | 29 | type = CANData; |
hudakz | 0:3d11ed680b6a | 30 | format = CANStandard; |
hudakz | 0:3d11ed680b6a | 31 | id = 0; |
hudakz | 0:3d11ed680b6a | 32 | memset(data, 0, 8); |
hudakz | 0:3d11ed680b6a | 33 | }; |
hudakz | 0:3d11ed680b6a | 34 | |
hudakz | 0:3d11ed680b6a | 35 | }; |
hudakz | 0:3d11ed680b6a | 36 | |
hudakz | 1:34738eb16cf7 | 37 | #endif // CANMSG_H |