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"
|
|
|
|
|
|
|
|
#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
|
|
|
|
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-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
|
2022-11-27 18:54:27 +08:00
|
|
|
}
|