63 lines
1.6 KiB
C
63 lines
1.6 KiB
C
#include "app_tasks.h"
|
|
#include "cmsis_os.h"
|
|
#include "bsp_can.h"
|
|
#include "bsp_usart.h"
|
|
#include "usb_device.h"
|
|
#include "c_comm.h"
|
|
#include "led.h"
|
|
#include "buzzer.h"
|
|
#if defined(ROBOT_TYPE_GIMBAL)
|
|
#include "gimbal.h"
|
|
#include "shoot.h"
|
|
#include "vision.h"
|
|
#elif defined(ROBOT_TYPE_CHASSIS)
|
|
#include "chassis.h"
|
|
#endif
|
|
|
|
volatile uint8_t app_ready = 0;//全部硬件初始化完成标志
|
|
volatile uint32_t dbg_can_loop = 0;//CAN_Task循环计数(诊断用)
|
|
|
|
static uint8_t dr16_rx_buf[36];//DR16单帧18字节,双倍缓冲防粘连
|
|
static uint8_t referee_rx_buf[128];//裁判系统变长帧接收缓冲
|
|
|
|
/*
|
|
*函数简介:硬件层统一初始化任务
|
|
*参数说明:FreeRTOS任务参数(未使用)
|
|
*返回类型:无
|
|
*备注:依次初始化LED/蜂鸣器/USB/CAN/电机/板间通讯/串口,完成后置app_ready=1
|
|
*/
|
|
void CAN_Task(void const * argument)
|
|
{
|
|
(void)argument;
|
|
|
|
led_init();
|
|
buzzer_init();
|
|
led_set_blue(1);//初始化期间蓝灯常亮
|
|
|
|
MX_USB_DEVICE_Init();
|
|
can_start();//CAN过滤器/启动/中断
|
|
|
|
#if defined(ROBOT_TYPE_GIMBAL)
|
|
gimbal_motor_init();
|
|
shoot_init();
|
|
c_comm_init();
|
|
|
|
usart3_init(dr16_rx_buf, 36, dr16_frame_callback);//DR16遥控器
|
|
usart6_init(referee_rx_buf, 128, referee_frame_callback);//图传链路(0x0304)
|
|
vision_init();//视觉上位机(USART1 DMA)
|
|
#elif defined(ROBOT_TYPE_CHASSIS)
|
|
chassis_motor_init();
|
|
c_comm_init();
|
|
|
|
usart6_init(referee_rx_buf, 128, referee_frame_callback);//裁判系统(0x0201/0x0202)
|
|
#endif
|
|
|
|
app_ready = 1;
|
|
|
|
for (;;)
|
|
{
|
|
dbg_can_loop++;
|
|
osDelay(1000);
|
|
}
|
|
}
|