From 22bddbcda74200f724cd02df793f17a246eb7303 Mon Sep 17 00:00:00 2001 From: Robofish <1683502971@qq.com> Date: Thu, 19 Jun 2025 01:10:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81=E6=A8=A1?= =?UTF-8?q?=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- task/task.c.template | 22 +++++++++++----------- task/user_task.c.template | 2 +- task/user_task.h.template | 17 +++++------------ 3 files changed, 17 insertions(+), 24 deletions(-) diff --git a/task/task.c.template b/task/task.c.template index 78b32bb..95f6a2c 100644 --- a/task/task.c.template +++ b/task/task.c.template @@ -1,22 +1,24 @@ /* {{task_name}} Task + {{task_description}} */ /* Includes ----------------------------------------------------------------- */ -#include "task\user_task.h" +#include "task/user_task.h" +/* USER INCLUDE BEGIN*/ + +/* USER INCLUDE END*/ /* Private typedef ---------------------------------------------------------- */ /* Private define ----------------------------------------------------------- */ /* Private macro ------------------------------------------------------------ */ /* Private variables -------------------------------------------------------- */ +/* USER STRUCT BEGIN*/ + +/* USER STRUCT END*/ + /* Private function --------------------------------------------------------- */ /* Exported functions ------------------------------------------------------- */ - -/** - * \brief {{task_name}} Task - * - * \param argument 未使用 - */ void {{task_function}}(void *argument) { (void)argument; /* 未使用argument,消除警告 */ @@ -28,11 +30,9 @@ void {{task_function}}(void *argument) { uint32_t tick = osKernelGetTickCount(); /* 控制任务运行频率的计时 */ while (1) { tick += delay_tick; /* 计算下一个唤醒时刻 */ - - /*User code begin*/ - - /*User code end*/ + /* USER CODE BEGIN */ + /* USER CODE END */ osDelayUntil(tick); /* 运行结束,等待下一次唤醒 */ } } diff --git a/task/user_task.c.template b/task/user_task.c.template index c068e2d..69f49f0 100644 --- a/task/user_task.c.template +++ b/task/user_task.c.template @@ -8,5 +8,5 @@ const osThreadAttr_t attr_init = { .stack_size = 256 * 4, }; -/* USER TASK */ +/* User_task */ {{task_attr_definitions}} diff --git a/task/user_task.h.template b/task/user_task.h.template index 391897a..79b7476 100644 --- a/task/user_task.h.template +++ b/task/user_task.h.template @@ -47,16 +47,16 @@ typedef struct { /* USER CONFIG END */ - /* 各任务运行频率 */ - struct { -{{freq_definitions}} - } freq; - /* 各任务的stack使用 */ struct { {{stack_definitions}} } stack_water_mark; + /* 各任务运行频率 */ + struct { +{{freq_definitions}} + } freq; + /* 任务最近运行时间 */ struct { {{last_up_time_definitions}} @@ -64,12 +64,6 @@ typedef struct { } Task_Runtime_t; - -/* 任务句柄 */ -typedef struct { -{{task_handle_definitions}} -} Task_Handles_t; - /* 任务运行时结构体 */ extern Task_Runtime_t task_runtime; @@ -77,7 +71,6 @@ extern Task_Runtime_t task_runtime; extern const osThreadAttr_t attr_init; {{task_attr_declarations}} - /* 任务函数声明 */ void Task_Init(void *argument); {{task_function_declarations}}