mirror of
https://github.com/goldenfishs/MRobot.git
synced 2025-05-03 16:00:54 +08:00
40 lines
1.1 KiB
Plaintext
40 lines
1.1 KiB
Plaintext
/*
|
||
初始化任务
|
||
*/
|
||
|
||
/* Includes ----------------------------------------------------------------- */
|
||
#include "task\user_task.h"
|
||
|
||
/* USER INCLUDE BEGIN */
|
||
|
||
/* USER INCLUDE BEGIN */
|
||
|
||
/* 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}}
|
||
|
||
// 创建消息队列
|
||
/* USER MESSAGE BEGIN */
|
||
task_runtime.msgq.user_msg= osMessageQueueNew(2u, 10, NULL);
|
||
/* USER MESSAGE END */
|
||
osKernelUnlock(); // 解锁内核
|
||
osThreadTerminate(osThreadGetId()); // 任务完成后结束自身
|
||
}
|
||
|