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