mirror of
				https://github.com/goldenfishs/MRobot.git
				synced 2025-10-31 07:05:43 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			56 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			56 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| #pragma once
 | |
| 
 | |
| #ifdef __cplusplus
 | |
| extern "C" {
 | |
| #endif
 | |
| 
 | |
| #include <cmsis_os2.h>
 | |
| #include "FreeRTOS.h"
 | |
| #include "task.h"
 | |
| 
 | |
| // 定义任务运行时结构体
 | |
| typedef struct {
 | |
|     /* 各任务,也可以叫做线程 */
 | |
|     struct {
 | |
| {{thread_definitions}}
 | |
|     } thread;
 | |
| 
 | |
|     struct {
 | |
|         osMessageQueueId_t user_msg; /* 用户自定义任务消息队列 */
 | |
|     } msgq;
 | |
| 
 | |
|     struct {
 | |
| {{freq_definitions}}
 | |
|     } freq; /* 任务运行频率 */
 | |
| 
 | |
|     struct {
 | |
| {{last_up_time_definitions}}
 | |
|     } last_up_time; /* 任务最近运行时间 */
 | |
| } Task_Runtime_t;
 | |
| 
 | |
| // 任务频率
 | |
| {{task_frequency_definitions}}
 | |
| // 任务初始化延时
 | |
| #define TASK_INIT_DELAY (100u)
 | |
| {{task_init_delay_definitions}}
 | |
| 
 | |
| // 任务句柄
 | |
| typedef struct {
 | |
| {{task_handle_definitions}}
 | |
| } Task_Handles_t;
 | |
| 
 | |
| // 任务运行时结构体
 | |
| extern Task_Runtime_t task_runtime;
 | |
| 
 | |
| // 初始化任务句柄
 | |
| extern const osThreadAttr_t attr_init;
 | |
| {{task_attr_declarations}}
 | |
| 
 | |
| // 任务函数声明
 | |
| void Task_Init(void *argument);
 | |
| {{task_function_declarations}}
 | |
| 
 | |
| #ifdef __cplusplus
 | |
| }
 | |
| #endif
 | 
