mirror of
https://github.com/goldenfishs/MRobot.git
synced 2025-04-28 23:39:55 +08:00
添加init
This commit is contained in:
parent
080bf0bb6b
commit
9236177b20
@ -3,7 +3,7 @@
|
||||
*/
|
||||
|
||||
/* Includes ----------------------------------------------------------------- */
|
||||
#include "task\user_task.h"
|
||||
#include "task\\user_task.h"
|
||||
/* Private typedef ---------------------------------------------------------- */
|
||||
/* Private define ----------------------------------------------------------- */
|
||||
/* Private macro ------------------------------------------------------------ */
|
||||
@ -21,9 +21,10 @@ void Task_Init(void *argument) {
|
||||
|
||||
osKernelLock(); // 锁定内核,防止任务切换
|
||||
|
||||
task_runtime.thread.user_task = osThreadNew(Task_UserTask, NULL, &attr_user_task);
|
||||
// 创建线程
|
||||
{{thread_creation_code}}
|
||||
|
||||
//创建消息队列
|
||||
// 创建消息队列
|
||||
task_runtime.msgq.user_msg= osMessageQueueNew(2u, 10, NULL);
|
||||
|
||||
osKernelUnlock(); // 解锁内核
|
||||
|
33
User/task/init.c.template
Normal file
33
User/task/init.c.template
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
初始化任务
|
||||
*/
|
||||
|
||||
/* 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()); // 任务完成后结束自身
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user