nana

Committer:
kurobikari
Date:
Wed Sep 01 02:43:33 2021 +0000
Revision:
5:d037e8c6ce88
Parent:
4:5017a65ff423
CAN

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hudakz 0:3d11ed680b6a 1
hudakz 0:3d11ed680b6a 2 #include "CAN.h"
hudakz 0:3d11ed680b6a 3
hudakz 4:5017a65ff423 4 class CANMsg : public mbed::CANMessage
hudakz 0:3d11ed680b6a 5 {
hudakz 0:3d11ed680b6a 6 public:
hudakz 0:3d11ed680b6a 7 /** Creates empty CAN message.
hudakz 0:3d11ed680b6a 8 */
hudakz 0:3d11ed680b6a 9 CANMsg() :
hudakz 0:3d11ed680b6a 10 CANMessage(){ }
hudakz 0:3d11ed680b6a 11
hudakz 0:3d11ed680b6a 12 /** Creates CAN message with specific content.
hudakz 0:3d11ed680b6a 13 */
hudakz 0:3d11ed680b6a 14 CANMsg(int _id, const char *_data, char _len = 8, CANType _type = CANData, CANFormat _format = CANStandard) :
hudakz 0:3d11ed680b6a 15 CANMessage(_id, _data, _len, _type, _format){ }
hudakz 0:3d11ed680b6a 16
hudakz 0:3d11ed680b6a 17 /** Creates CAN remote message.
hudakz 0:3d11ed680b6a 18 */
hudakz 0:3d11ed680b6a 19 CANMsg(int _id, CANFormat _format = CANStandard) :
hudakz 0:3d11ed680b6a 20 CANMessage(_id, _format){ }
hudakz 0:3d11ed680b6a 21
hudakz 0:3d11ed680b6a 22 /** Clears CAN message content
hudakz 0:3d11ed680b6a 23 */
hudakz 0:3d11ed680b6a 24 void clear(void) {
hudakz 0:3d11ed680b6a 25 len = 0;
hudakz 0:3d11ed680b6a 26 type = CANData;
hudakz 0:3d11ed680b6a 27 format = CANStandard;
hudakz 0:3d11ed680b6a 28 id = 0;
hudakz 0:3d11ed680b6a 29 memset(data, 0, 8);
hudakz 0:3d11ed680b6a 30 };
hudakz 0:3d11ed680b6a 31 };
hudakz 0:3d11ed680b6a 32
kurobikari 5:d037e8c6ce88 33