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.
135 lines
3.8 KiB
135 lines
3.8 KiB
|
2 months ago
|
/******************************************************************************
|
||
|
|
|
||
|
|
版权所有 (C), 2018-2099, Radkil
|
||
|
|
|
||
|
|
******************************************************************************
|
||
|
2 weeks ago
|
文 件 名 : BHBF.h
|
||
|
2 months ago
|
版 本 号 : 初稿
|
||
|
|
作 者 : radkil
|
||
|
|
生成日期 : 2026年6月8日
|
||
|
|
最近修改 :
|
||
|
2 weeks ago
|
功能描述 : BHBF.c 的头文件
|
||
|
2 months ago
|
|
||
|
|
修改历史 :
|
||
|
|
1.日 期 : 2026年6月8日
|
||
|
|
作 者 : radkil
|
||
|
|
修改内容 : 创建文件
|
||
|
|
|
||
|
|
******************************************************************************/
|
||
|
|
|
||
|
|
/*----------------------------------------------*
|
||
|
|
* 外部变量说明 *
|
||
|
|
*----------------------------------------------*/
|
||
|
|
|
||
|
|
/*----------------------------------------------*
|
||
|
|
* 外部函数原型说明 *
|
||
|
|
*----------------------------------------------*/
|
||
|
|
|
||
|
|
/*----------------------------------------------*
|
||
|
|
* 内部函数原型说明 *
|
||
|
|
*----------------------------------------------*/
|
||
|
|
|
||
|
|
/*----------------------------------------------*
|
||
|
|
* 全局变量 *
|
||
|
|
*----------------------------------------------*/
|
||
|
|
|
||
|
|
/*----------------------------------------------*
|
||
|
|
* 模块级变量 *
|
||
|
|
*----------------------------------------------*/
|
||
|
|
|
||
|
|
/*----------------------------------------------*
|
||
|
|
* 常量定义 *
|
||
|
|
*----------------------------------------------*/
|
||
|
|
|
||
|
|
/*----------------------------------------------*
|
||
|
|
* 宏定义 *
|
||
|
|
*----------------------------------------------*/
|
||
|
|
|
||
|
2 weeks ago
|
#ifndef __BHBF_H__
|
||
|
|
#define __BHBF_H__
|
||
|
2 months ago
|
|
||
|
|
|
||
|
|
#ifdef __cplusplus
|
||
|
|
#if __cplusplus
|
||
|
|
extern "C"{
|
||
|
|
#endif
|
||
|
|
#endif /* __cplusplus */
|
||
|
|
|
||
|
|
|
||
|
|
/*==============================================*
|
||
|
|
* include header files *
|
||
|
|
*----------------------------------------------*/
|
||
|
|
#include "drv_interface.h"
|
||
|
|
#include "rd_time.h"
|
||
|
2 weeks ago
|
#include "msg_center.h"
|
||
|
|
#include "cmsis_os.h"
|
||
|
|
#include "FreeRTOS.h"
|
||
|
2 months ago
|
|
||
|
|
/*==============================================*
|
||
|
|
* constants or macros define *
|
||
|
|
*----------------------------------------------*/
|
||
|
2 weeks ago
|
#define MODULE_NAME_MOTOR "motor"
|
||
|
|
|
||
|
|
typedef enum {
|
||
|
|
MOTOR_CMD_SET_SPEED = 0x01, // 设置速度
|
||
|
|
MOTOR_CMD_SET_POSITION = 0x02, // 设置位置
|
||
|
|
MOTOR_CMD_STOP = 0x03, // 停止
|
||
|
|
MOTOR_CMD_GET_STATUS = 0x04, // 获取状态
|
||
|
|
MOTOR_CMD_SET_HOME = 0x05, // 设置零点
|
||
|
|
MOTOR_CMD_SPEED_MODE = 0x06, // 速度模式
|
||
|
|
MOTOR_CMD_POSITION_MODE = 0x07, // 位置模式
|
||
|
|
} Motor_Cmd_e;
|
||
|
|
|
||
|
|
// 电机命令数据结构
|
||
|
|
typedef struct {
|
||
|
|
uint8_t m_ucMotorIndex; // 电机索引(0=左轮,1=右轮)
|
||
|
|
int32_t m_iValue; // 值(速度/位置等)
|
||
|
|
} Motor_CmdData_t;
|
||
|
|
|
||
|
|
// 电机状态数据结构
|
||
|
|
typedef struct {
|
||
|
|
uint8_t m_ucMotorIndex;
|
||
|
|
int32_t m_iPosition;
|
||
|
|
int32_t m_iVelocity;
|
||
|
|
uint32_t m_uiFaultCode;
|
||
|
|
} Motor_StatusData_t;
|
||
|
|
|
||
|
|
#define MODULE_NAME_RBCORE "RBcore"
|
||
|
|
|
||
|
2 months ago
|
typedef enum {
|
||
|
|
GF_CMD_DEFAULT_NULL = 0,
|
||
|
|
GF_CMD_STOP_ALL,
|
||
|
|
GF_CMD_MANUAL_FORWARD,
|
||
|
|
GF_CMD_MANUAL_BACKWARD,
|
||
|
|
GF_CMD_AUTO_FORWARD
|
||
|
|
} GF_CMD;
|
||
|
|
|
||
|
|
typedef struct _GV_struct_define
|
||
|
|
{
|
||
|
|
int m_iWorkMode;
|
||
|
|
GF_CMD m_eGFCmd;
|
||
|
|
int32_t m_iMoveSpeed[2];//索引1对应左轮,索引2对应右轮
|
||
|
2 weeks ago
|
} GV_define;
|
||
|
2 months ago
|
|
||
|
|
/*==============================================*
|
||
|
|
* project-wide global variables *
|
||
|
|
*----------------------------------------------*/
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
/*==============================================*
|
||
|
|
* routines' or functions' implementations *
|
||
|
|
*----------------------------------------------*/
|
||
|
2 weeks ago
|
GV_define *GetGV(void);
|
||
|
|
void SetGV(GV_define *_pGV);
|
||
|
2 months ago
|
// 待实现接口
|
||
|
|
|
||
|
|
#ifdef __cplusplus
|
||
|
|
#if __cplusplus
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
#endif /* __cplusplus */
|
||
|
|
|
||
|
|
|
||
|
|
#endif /* __BHBF_ROBOT_H__ */
|