Steering_Wheel_Infatry/User/device/motor_step.h

44 lines
880 B
C

/*
* 步进电机
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ----------------------------------------------------------------- */
#include "cmsis_os2.h"
#include <stdbool.h>
#include "bsp/pwm.h"
/* Exported constants ------------------------------------------------------- */
/* Exported macro ----------------------------------------------------------- */
/* Exported types ----------------------------------------------------------- */
/*每个电机需要的参数*/
typedef struct {
BSP_PWM_Channel_t channel;
bool reverse;
bool gear;
} MOTOR_STEP_Param_t;
typedef struct{
MOTOR_STEP_Param_t param;
/* 脉冲个数 */
int pulse;
}MOTOR_STEP_t;
int8_t Motor_Step_Init(MOTOR_STEP_t *param);
int8_t Motor_Step_Ctrl(MOTOR_STEP_t *param);
int8_t Motor_Step_Stop(MOTOR_STEP_t *motor_step);
#ifdef __cplusplus
}
#endif