#pragma once #ifdef __cplusplus extern "C" { #endif /* Includes ----------------------------------------------------------------- */ #include #include "FreeRTOS.h" #include "task.h" /* USER INCLUDE BEGIN */ #include "module/config.h" #define DEBUG /* USER INCLUDE END */ /* Exported constants ------------------------------------------------------- */ /* 任务运行频率 */ #define TEST_FREQ (500.0) #define YAOKONGQI_FREQ (500.0) /* 任务初始化延时ms */ #define TASK_INIT_DELAY (100u) #define TEST_INIT_DELAY (0) #define YAOKONGQI_INIT_DELAY (0) /* Exported defines --------------------------------------------------------- */ /* Exported macro ----------------------------------------------------------- */ /* Exported types ----------------------------------------------------------- */ /* 任务运行时结构体 */ typedef struct { /* 各任务,也可以叫做线程 */ struct { osThreadId_t test; osThreadId_t yaokongqi; } thread; /* USER MESSAGE BEGIN */ struct { osMessageQueueId_t user_msg; /* 用户自定义任务消息队列 */ osMessageQueueId_t dr16_data; /* dr16遥控器数据 */ struct { osMessageQueueId_t imu; osMessageQueueId_t cmd; osMessageQueueId_t yaw; }chassis; } msgq; /* USER MESSAGE END */ /* 机器人状态 */ struct { float battery; /* 电池电量百分比 */ float vbat; /* 电池电压 */ float cpu_temp; /* CPU温度 */ } status; /* USER CONFIG BEGIN */ /* USER CONFIG END */ /* 各任务的stack使用 */ struct { UBaseType_t test; UBaseType_t yaokongqi; } stack_water_mark; /* 各任务运行频率 */ struct { float test; float yaokongqi; } freq; /* 任务最近运行时间 */ struct { float test; float yaokongqi; } last_up_time; } Task_Runtime_t; /* 任务运行时结构体 */ extern Task_Runtime_t task_runtime; /* 初始化任务句柄 */ extern const osThreadAttr_t attr_init; extern const osThreadAttr_t attr_test; extern const osThreadAttr_t attr_yaokongqi; /* 任务函数声明 */ void Task_Init(void *argument); void Task_test(void *argument); void Task_yaokongqi(void *argument); #ifdef __cplusplus } #endif