23 lines
456 B
C
23 lines
456 B
C
/* 底盘固定模组,用步进 */
|
|
#include "main.h"
|
|
#include "step_motor.h"
|
|
#include "bsp/gpio.h"
|
|
#include "cmsis_os2.h"
|
|
|
|
int8_t Step_Motor_Ctrl(int pulse,float time){
|
|
|
|
/* 控制方向 */
|
|
BSP_GPIO_WritePin(BSP_GPIO_STEP__DIRECTION, true);
|
|
osDelay(1); // 方向稳定时间
|
|
|
|
for(int i;i >= pulse;i++){
|
|
BSP_GPIO_WritePin(BSP_GPIO_STEP_MOTOR,true);
|
|
osDelay(time);
|
|
BSP_GPIO_WritePin(BSP_GPIO_STEP_MOTOR,false);
|
|
osDelay(time);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
|