|
|
@ -0,0 +1,34 @@ |
|
|
|
#include "steering_gear.h" |
|
|
|
|
|
|
|
#include <stdio.h> |
|
|
|
|
|
|
|
void steering_gear_set_position(PORT serial_com, int switch_position_mode) { |
|
|
|
char buf_position_0[] = {0xff, 0xff, 0x01, 0x07, 0x03, 0x2a, 0x00, 0x00, 0x00, 0x00, 0xca}; |
|
|
|
char buf_position_1024[] = {0xff, 0xff, 0x01, 0x07, 0x03, 0x2a, 0x04, 0x00, 0x00, 0x00, 0xc6}; |
|
|
|
char buf_position_2048[] = {0xff, 0xff, 0x01, 0x07, 0x03, 0x2a, 0x08, 0x00, 0x00, 0x00, 0xc2}; |
|
|
|
char buf_position_3071[] = {0xff, 0xff, 0x01, 0x07, 0x03, 0x2a, 0x0b, 0xff, 0x00, 0x00, 0xc0}; |
|
|
|
char buf_position_4095[] = {0xff, 0xff, 0x01, 0x07, 0x03, 0x2a, 0x0f, 0xff, 0x00, 0x00, 0xbc}; |
|
|
|
|
|
|
|
printf("switch:%d\n", switch_position_mode); |
|
|
|
|
|
|
|
switch (switch_position_mode) { |
|
|
|
case 0: |
|
|
|
Serial_SendData(serial_com, buf_position_0, sizeof(buf_position_0)); |
|
|
|
break; |
|
|
|
case 1: |
|
|
|
Serial_SendData(serial_com, buf_position_1024, sizeof(buf_position_1024)); |
|
|
|
break; |
|
|
|
case 2: |
|
|
|
Serial_SendData(serial_com, buf_position_2048, sizeof(buf_position_2048)); |
|
|
|
break; |
|
|
|
case 3: |
|
|
|
Serial_SendData(serial_com, buf_position_3071, sizeof(buf_position_3071)); |
|
|
|
break; |
|
|
|
case 4: |
|
|
|
Serial_SendData(serial_com, buf_position_4095, sizeof(buf_position_4095)); |
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
} |