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.

138 lines
4.0 KiB

2 months ago
/******************************************************************************
(C), 2018-2099, Radkil
******************************************************************************
: BHBF.h
2 months ago
: 稿
: radkil
: 202668
:
: BHBF.c
2 months ago
:
1. : 202668
: radkil
:
******************************************************************************/
/*----------------------------------------------*
* *
*----------------------------------------------*/
/*----------------------------------------------*
* *
*----------------------------------------------*/
/*----------------------------------------------*
* *
*----------------------------------------------*/
/*----------------------------------------------*
* *
*----------------------------------------------*/
/*----------------------------------------------*
* *
*----------------------------------------------*/
/*----------------------------------------------*
* *
*----------------------------------------------*/
/*----------------------------------------------*
* *
*----------------------------------------------*/
#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"
#include "msg_center.h"
#include "cmsis_os.h"
#include "FreeRTOS.h"
2 months ago
/*==============================================*
* constants or macros define *
*----------------------------------------------*/
#define MODULE_NAME_RBCORE "RBcore"
#define MODULE_NAME_MOTOR "motor"
typedef enum {
MOTOR_CMD_SET_SPEED = 0x0001, // 设置速度
MOTOR_CMD_SET_POSITION, // 设置位置
MOTOR_CMD_STOP, // 停止
MOTOR_CMD_GET_STATUS, // 获取状态
MOTOR_CMD_SET_HOME, // 设置零点
MOTOR_CMD_SPEED_MODE, // 速度模式
MOTOR_CMD_POSITION_MODE, // 位置模式
MOTOR_CMD_END = 0x0100,
RBCORE_CMD_STOP_ALL, // 机器人停止
RBCORE_CMD_MANUAL_FORWARD, // 机器人手动前进
RBCORE_CMD_MANUAL_BACKWARD, // 机器人手动后退
RBCORE_CMD_MANUAL_TURNLEFT, // 机器人手动左转
RBCORE_CMD_MANUAL_TURNRIGHT, // 机器人手动右转
} 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;
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对应右轮
} GV_define;
2 months ago
/*==============================================*
* project-wide global variables *
*----------------------------------------------*/
void RBcore_Init(void);
2 months ago
/*==============================================*
* routines' or functions' implementations *
*----------------------------------------------*/
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* __cplusplus */
#endif /* __BHBF_ROBOT_H__ */