R2_UP/User/task/init.c

93 lines
2.9 KiB
C
Raw Permalink Normal View History

2025-03-12 10:46:02 +08:00
/*
线 ID等等
user_task.h中定义一系列参数 线user_task.c中定
*/
/* Includes ----------------------------------------------------------------- */
#include "Device\bmi088.h"
#include "task\user_task.h"
#include "can_use.h"
#include "cmd.h"
#include "Action.h"
/* Private typedef ---------------------------------------------------------- */
/* Private define ----------------------------------------------------------- */
/* Private macro ------------------------------------------------------------ */
/* Private variables -------------------------------------------------------- */
/* Private function --------------------------------------------------------- */
/* Exported functions ------------------------------------------------------- */
/**
* \brief
*
* \param argument 使
*/
void Task_Init(void *argument) {
(void)argument;
////
Config_Get(&task_runtime.config);
osKernelLock();
/* 任务*/
task_runtime.thread.atti_esti =
osThreadNew(Task_AttiEsti, NULL, &attr_atti_esti);
task_runtime.thread.dr16 =
osThreadNew(Task_dr16,NULL,&attr_dr16);
task_runtime.thread.can =
osThreadNew(Task_can,NULL,&attr_can);
task_runtime.thread.cmd =
osThreadNew(Task_cmd,NULL,&attr_cmd);
task_runtime.thread.nuc =
osThreadNew(Task_nuc,NULL,&attr_nuc);
task_runtime.thread.up=
osThreadNew(Task_up,NULL,&attr_up);
task_runtime.thread.error_detect =
osThreadNew(Task_error_detect,NULL,&attr_error_detect);
/* 消息队列 */
/* can */
task_runtime.msgq.can.feedback.CAN_feedback =
osMessageQueueNew(2u, sizeof(CAN_t), NULL);
task_runtime.msgq.can.feedback.shoot5065_feedback =
osMessageQueueNew(2u, sizeof(CAN_t), NULL);
task_runtime.msgq.can.output.shoot5065 =
osMessageQueueNew(2u, sizeof(CAN_VescOutput_t), NULL);
task_runtime.msgq.can.output.chassis3508 =
osMessageQueueNew(2u, sizeof(CAN_DJIOutput_t), NULL);
task_runtime.msgq.can.output.pitch6020 =
osMessageQueueNew(2u, sizeof(CAN_DJIOutput_t), NULL);
task_runtime.msgq.can.output.chassis6020 =
osMessageQueueNew(2u, sizeof(CAN_DJIOutput_t), NULL);
/* imu */
task_runtime.msgq.imu.accl =
osMessageQueueNew(2u, sizeof(AHRS_Accl_t), NULL);
task_runtime.msgq.imu.eulr =
osMessageQueueNew(2u, sizeof(AHRS_Eulr_t), NULL);
task_runtime.msgq.imu.gyro =
osMessageQueueNew(2u, sizeof(AHRS_Gyro_t), NULL);
/*cmd */
task_runtime.msgq.cmd.raw.rc =
osMessageQueueNew(3u, sizeof(CMD_RC_t), NULL);
task_runtime.msgq.cmd.raw.nuc =
osMessageQueueNew(3u,sizeof(CMD_NUC_t), NULL);
osKernelUnlock();
osThreadTerminate(osThreadGetId()); /* 结束自身 */
}