Files

52 lines
1.3 KiB
C
Raw Permalink Normal View History

#ifndef __APP_MOTOR_H__
#define __APP_MOTOR_H__
#include <stdint.h>
#include <stdbool.h>
#include "CANopen.h"
#include "OD.h"
#include "Int_TMC2209.h"
#include "Com_debug.h"
#include "CiA402_defs.h"
#include "app_CiA402.h"
#include <stdlib.h>
#include "Int_Encoder.h"
// --- 全局变量引用 ---
extern Stepper_t stepper_1; // 引用在 app_main.c 中定义的电机对象
extern Encoder_t encoder_1; // 引用在 app_main.c 中定义的编码器对象
extern CO_t *CO; // 引用在 CO_app_STM32.c 中定义的 CANopen 对象
// 记录当前的绝对位置 (mm)
extern float current_absolute_pos_mm; // 当前绝对位置
extern float last_move_start_pos_mm; // 每次动作开始时的绝对位置
// 两个状态机分别对应位置模式和回零模式枚举类型的定义在CiA402_defs.h 中定义
extern Motor_State_t internal_state;
extern Homing_State_t homing_state;
// --- 函数声明 ---
/**
* @brief
*/
void App_Motor_Init(void);
/**
* @brief
*/
void App_Motor_Process(void);
/**
* @brief
*
*/
void App_Motor_StepLossCheck(void);
/**
* @brief mm true
*/
bool App_Motor_TryGetStopError(float *err_mm);
#endif /* __APP_MOTOR_H__ */