MRobot/User/task/init.c.template
2025-04-27 14:55:07 +08:00

34 lines
1.0 KiB
Plaintext
Raw 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.

/*
初始化任务
*/
/* Includes ----------------------------------------------------------------- */
#include "task\user_task.h"
/* Private typedef ---------------------------------------------------------- */
/* Private define ----------------------------------------------------------- */
/* Private macro ------------------------------------------------------------ */
/* Private variables -------------------------------------------------------- */
/* Private function --------------------------------------------------------- */
/* Exported functions ------------------------------------------------------- */
/**
* \brief 初始化
*
* \param argument 未使用
*/
void Task_Init(void *argument) {
(void)argument; /* 未使用argument消除警告 */
osKernelLock(); // 锁定内核,防止任务切换
// 创建线程
{{thread_creation_code}}
// 创建消息队列
task_runtime.msgq.user_msg= osMessageQueueNew(2u, 10, NULL);
osKernelUnlock(); // 解锁内核
osThreadTerminate(osThreadGetId()); // 任务完成后结束自身
}