1
MODE/mode.cpp@0:6aa5928be32a, 2021-06-18 (annotated)
- Committer:
- panzhan
- Date:
- Fri Jun 18 07:17:12 2021 +0000
- Revision:
- 0:6aa5928be32a
1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
panzhan | 0:6aa5928be32a | 1 | #include "mode.h" |
panzhan | 0:6aa5928be32a | 2 | #include "CAN.h" |
panzhan | 0:6aa5928be32a | 3 | |
panzhan | 0:6aa5928be32a | 4 | |
panzhan | 0:6aa5928be32a | 5 | |
panzhan | 0:6aa5928be32a | 6 | // |
panzhan | 0:6aa5928be32a | 7 | void Zero(CANMessage * msg){ |
panzhan | 0:6aa5928be32a | 8 | msg->data[0] = 0xFF; |
panzhan | 0:6aa5928be32a | 9 | msg->data[1] = 0xFF; |
panzhan | 0:6aa5928be32a | 10 | msg->data[2] = 0xFF; |
panzhan | 0:6aa5928be32a | 11 | msg->data[3] = 0xFF; |
panzhan | 0:6aa5928be32a | 12 | msg->data[4] = 0xFF; |
panzhan | 0:6aa5928be32a | 13 | msg->data[5] = 0xFF; |
panzhan | 0:6aa5928be32a | 14 | msg->data[6] = 0xFF; |
panzhan | 0:6aa5928be32a | 15 | msg->data[7] = 0xFE; |
panzhan | 0:6aa5928be32a | 16 | WriteAll(); |
panzhan | 0:6aa5928be32a | 17 | } |
panzhan | 0:6aa5928be32a | 18 | |
panzhan | 0:6aa5928be32a | 19 | |
panzhan | 0:6aa5928be32a | 20 | // 进入电机模式 |
panzhan | 0:6aa5928be32a | 21 | void EnterMotorMode(CANMessage * msg){ |
panzhan | 0:6aa5928be32a | 22 | msg->data[0] = 0xFF; |
panzhan | 0:6aa5928be32a | 23 | msg->data[1] = 0xFF; |
panzhan | 0:6aa5928be32a | 24 | msg->data[2] = 0xFF; |
panzhan | 0:6aa5928be32a | 25 | msg->data[3] = 0xFF; |
panzhan | 0:6aa5928be32a | 26 | msg->data[4] = 0xFF; |
panzhan | 0:6aa5928be32a | 27 | msg->data[5] = 0xFF; |
panzhan | 0:6aa5928be32a | 28 | msg->data[6] = 0xFF; |
panzhan | 0:6aa5928be32a | 29 | msg->data[7] = 0xFC; |
panzhan | 0:6aa5928be32a | 30 | WriteAll(); |
panzhan | 0:6aa5928be32a | 31 | } |
panzhan | 0:6aa5928be32a | 32 | |
panzhan | 0:6aa5928be32a | 33 | |
panzhan | 0:6aa5928be32a | 34 | // 退出电机模式 |
panzhan | 0:6aa5928be32a | 35 | void ExitMotorMode(CANMessage * msg){ |
panzhan | 0:6aa5928be32a | 36 | msg->data[0] = 0xFF; |
panzhan | 0:6aa5928be32a | 37 | msg->data[1] = 0xFF; |
panzhan | 0:6aa5928be32a | 38 | msg->data[2] = 0xFF; |
panzhan | 0:6aa5928be32a | 39 | msg->data[3] = 0xFF; |
panzhan | 0:6aa5928be32a | 40 | msg->data[4] = 0xFF; |
panzhan | 0:6aa5928be32a | 41 | msg->data[5] = 0xFF; |
panzhan | 0:6aa5928be32a | 42 | msg->data[6] = 0xFF; |
panzhan | 0:6aa5928be32a | 43 | msg->data[7] = 0xFD; |
panzhan | 0:6aa5928be32a | 44 | WriteAll(); |
panzhan | 0:6aa5928be32a | 45 | } |