r1upper/User/task/initTask.c
2025-04-12 15:18:06 +08:00

42 lines
1.1 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 初始化任务
*/
#include "TopDefine.h"
#include "userTask.h"
#include "nuc.h"
/*********************/
/**
* \brief 初始化
*
* \param argument 未使用
*/
void initFunction(void *argument)
{
(void)argument; /* 未使用argument消除警告 */
osKernelLock();
/* 创建任务 */
task_struct.thread.gimbal =
osThreadNew(FunctionGimbal, NULL, &attr_gimbal);
task_struct.thread.shoot =
osThreadNew(FunctionShoot, NULL, &attr_shoot);
task_struct.thread.can =
osThreadNew(FunctionCan, NULL, &attr_can);
task_struct.thread.ball =
osThreadNew(FunctionBall, NULL, &attr_ball);
task_struct.thread.nuc =
osThreadNew(Function_nuc, NULL, &attr_nuc);
/* 创建消息队列 */
// task_struct.msgq.msg =
// osMessageQueueNew(2u, sizeof(CAN_CapOutput_t), NULL);
task_struct.msgq.nuc =
osMessageQueueNew(2u, sizeof(NUC_t), NULL);
/*创建事件组*/
task_struct.events.eventReceive = osEventFlagsNew(&attr_event);
osKernelUnlock();
osThreadTerminate(osThreadGetId()); /* 结束自身 */
}