You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
1.0 KiB

1 year ago
#include "bsp_moto.h"
#include "c_delay.h"
#include "debug_drv.h"
TS_moto_ ts_moto=
{
D_MOTO_STOP
};
void L0_moto_run(unsigned char mode)
{
switch (mode)
{
case D_MOTO_FORWARD:
D_Motor_BI_ON();
///D_Motor_BI_OFF();
///D_Motor_FI_ON();
D_Motor_FI_OFF();
ts_moto.mode = mode|0x80;
printf(" F ");
break;
case D_MOTO_BACKWARD:
///D_Motor_BI_ON();
D_Motor_BI_OFF();
D_Motor_FI_ON();
ts_moto.mode = mode|0x80;
printf(" B ");
///D_Motor_FI_OFF();
break;
case D_MOTO_STOP:
D_Motor_BI_ON();
///D_Motor_BI_OFF();
D_Motor_FI_ON();
ts_moto.mode = mode;
printf(" T ");
///D_Motor_FI_OFF();
break;
default :
///D_Motor_BI_ON();
D_Motor_BI_OFF();
///D_Motor_FI_ON();
D_Motor_FI_OFF();
ts_moto.mode = mode;
////:D_MOTO_STANDBY
printf(" S ");
break;
}
}
void L0_moto_init(unsigned char onf)
{
if(onf)
{
L0_moto_run(D_MOTO_STANDBY);
D_MOTOR_IO_OPEN();
printf("\r\nD_MOTOR_IO_OPEN\r\n");
}else
{
L0_moto_run(D_MOTO_STANDBY);
D_MOTOR_IO_CLOSE();
}
}