Compare commits

...

2 Commits

Author SHA1 Message Date
345743a1c6 修改task.c 2025-06-20 01:14:07 +08:00
91eeda0e07 添加自动移控制功能 2025-06-20 00:30:57 +08:00

View File

@ -22,6 +22,7 @@
void {{task_function}}(void *argument) {
(void)argument; /* 未使用argument消除警告 */
{% if freq_control %}
/* 计算任务运行到指定频率需要等待的tick数 */
const uint32_t delay_tick = osKernelGetTickFreq() / {{task_frequency}};
@ -39,4 +40,17 @@ void {{task_function}}(void *argument) {
/* USER CODE END */
osDelayUntil(tick); /* 运行结束,等待下一次唤醒 */
}
{% else %}
osDelay({{task_delay}}); /* 延时一段时间再开启任务 */
/* USER CODE INIT BEGIN*/
/* USER CODE INIT END*/
while (1) {
/* USER CODE BEGIN */
/* USER CODE END */
}
{% endif %}
}