93 lines
2.9 KiB
C
93 lines
2.9 KiB
C
|
/*
|
|||
|
初始化
|
|||
|
|
|||
|
线程都需要在此处配置任务句柄 队列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()); /* 结束自身 */
|
|||
|
}
|