2022-12-09 18:25:35 +08:00
# include "bsp_init.h"
2022-11-27 18:54:27 +08:00
# include "robot.h"
# include "robot_def.h"
2023-06-05 22:43:25 +08:00
# include "robot_task.h"
2022-11-27 18:54:27 +08:00
2023-02-15 18:28:25 +08:00
// 编译warning,提醒开发者修改机器人参数
# ifndef ROBOT_DEF_PARAM_WARNING
# define ROBOT_DEF_PARAM_WARNING
2023-07-14 17:24:44 +08:00
# pragma message "check if you have configured the parameters in robot_def.h, IF NOT, please refer to the comments AND DO IT, otherwise the robot will have FATAL ERRORS!!!"
2023-02-15 18:28:25 +08:00
# endif // !ROBOT_DEF_PARAM_WARNING
2022-11-27 18:54:27 +08:00
# if defined(ONE_BOARD) || defined(CHASSIS_BOARD)
# include "chassis.h"
2022-12-04 13:49:08 +08:00
# endif
2023-01-02 23:50:04 +08:00
2022-11-27 18:54:27 +08:00
# if defined(ONE_BOARD) || defined(GIMBAL_BOARD)
# include "gimbal.h"
# include "shoot.h"
2022-12-04 13:49:08 +08:00
# include "robot_cmd.h"
# endif
2022-12-03 15:20:17 +08:00
2023-04-14 18:17:46 +08:00
2022-11-27 18:54:27 +08:00
void RobotInit ( )
2023-02-03 15:25:58 +08:00
{
// 关闭中断,防止在初始化过程中发生中断
2023-02-04 15:38:05 +08:00
// 请不要在初始化过程中使用中断和延时函数!
// 若必须,则只允许使用DWT_Delay()
2023-02-03 15:25:58 +08:00
__disable_irq ( ) ;
2023-02-04 15:38:05 +08:00
2022-12-09 18:25:35 +08:00
BSPInit ( ) ;
2022-11-27 18:54:27 +08:00
# if defined(ONE_BOARD) || defined(GIMBAL_BOARD)
2023-01-01 17:32:22 +08:00
RobotCMDInit ( ) ;
2022-12-03 15:20:17 +08:00
GimbalInit ( ) ;
ShootInit ( ) ;
2022-12-04 13:49:08 +08:00
# endif
2022-11-27 18:54:27 +08:00
# if defined(ONE_BOARD) || defined(CHASSIS_BOARD)
2022-12-11 14:59:45 +08:00
ChassisInit ( ) ;
2022-12-04 13:49:08 +08:00
# endif
2023-04-14 18:17:46 +08:00
2023-06-05 22:43:25 +08:00
OSTaskInit ( ) ; // 创建基础任务
2023-02-03 15:25:58 +08:00
// 初始化完成,开启中断
__enable_irq ( ) ;
2022-12-11 14:59:45 +08:00
}
2022-11-27 18:54:27 +08:00
2022-12-11 14:59:45 +08:00
void RobotTask ( )
{
2022-11-27 18:54:27 +08:00
# if defined(ONE_BOARD) || defined(GIMBAL_BOARD)
2022-12-19 17:15:42 +08:00
RobotCMDTask ( ) ;
2022-12-03 15:20:17 +08:00
GimbalTask ( ) ;
ShootTask ( ) ;
2022-12-04 13:49:08 +08:00
# endif
2022-12-11 14:59:45 +08:00
# if defined(ONE_BOARD) || defined(CHASSIS_BOARD)
ChassisTask ( ) ;
# endif
2023-04-14 18:17:46 +08:00
2023-06-05 22:43:25 +08:00
}