110 lines
1.9 KiB
C
110 lines
1.9 KiB
C
|
|
#include "RTE.h"
|
|
#include "hwctrl.h"
|
|
#include "mcu.h"
|
|
#include "canuser.h"
|
|
|
|
extern McuType mcu;
|
|
|
|
uint8_T CAN0X301_DATA[8] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
|
|
uint8_T Motor_state[6] = {0,0,0,0,0,0};
|
|
|
|
CAN_DATATYPE rte_get_CANMSG_0x201(void)
|
|
{
|
|
CAN_DATATYPE CANMsg_0x201;
|
|
CANMsg_0x201.ID = 0x201;
|
|
GetRxMsgData(0x201,CANMsg_0x201.Data,8);
|
|
CANMsg_0x201.Length = 8;
|
|
CANMsg_0x201.Remote = 0;
|
|
CANMsg_0x201.Extended = 0;
|
|
CANMsg_0x201.Error = 0;
|
|
|
|
return CANMsg_0x201;
|
|
|
|
|
|
}
|
|
|
|
uint8_T rte_get_CANMSG_0x301_DATA(int32_T i)
|
|
{
|
|
return 0x00;
|
|
}
|
|
|
|
void rte_set_CANMSG_0x301_DATA(int32_T i,uint8_T data)
|
|
{
|
|
if (i >= 0 && i <= 7)
|
|
{
|
|
CAN0X301_DATA[i] = data;
|
|
}
|
|
if (i == 7)
|
|
{
|
|
SetTxMsgData(0x301,CAN0X301_DATA,8);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void rte_set_Motor_HG_State(uint8_T act)
|
|
{
|
|
hw_MotorCtrl(&mcu,Motor1,act);
|
|
Motor_state[Motor1] = act;
|
|
}
|
|
|
|
void rte_set_Motor_KB_State(uint8_T act)
|
|
{
|
|
hw_MotorCtrl(&mcu,Motor2,act);
|
|
Motor_state[Motor2] = act;
|
|
}
|
|
|
|
void rte_set_Motor_TT_State(uint8_T act)
|
|
{
|
|
hw_MotorCtrl(&mcu,Motor3,act);
|
|
Motor_state[Motor3] = act;
|
|
}
|
|
|
|
void rte_set_Motor_ZY_State(uint8_T act)
|
|
{
|
|
hw_MotorCtrl(&mcu,Motor4,act);
|
|
Motor_state[Motor4] = act;
|
|
}
|
|
|
|
void rte_set_Motor_TZ_State(uint8_T act)
|
|
{
|
|
hw_MotorCtrl(&mcu,Motor5,act);
|
|
Motor_state[Motor5] = act;
|
|
}
|
|
|
|
void rte_set_Motor_YT_State(uint8_T act)
|
|
{
|
|
hw_MotorCtrl(&mcu,Motor6,act);
|
|
Motor_state[Motor6] = act;
|
|
}
|
|
|
|
|
|
uint8_T rte_get_Motor_HG_State(void)
|
|
{
|
|
return Motor_state[Motor1];
|
|
}
|
|
uint8_T rte_get_Motor_KB_State(void)
|
|
{
|
|
return Motor_state[Motor2];
|
|
}
|
|
uint8_T rte_get_Motor_TT_State(void)
|
|
{
|
|
return Motor_state[Motor3];
|
|
}
|
|
uint8_T rte_get_Motor_ZY_State(void)
|
|
{
|
|
return Motor_state[Motor4];
|
|
}
|
|
uint8_T rte_get_Motor_TZ_State(void)
|
|
{
|
|
return Motor_state[Motor5];
|
|
}
|
|
uint8_T rte_get_Motor_YT_State(void)
|
|
{
|
|
return Motor_state[Motor6];
|
|
}
|
|
|
|
|