shoot/User/task/initTask.c
2025-03-12 23:04:18 +08:00

85 lines
2.6 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
初始化任务
根据机器人的FLASH配置决定生成哪些任务。
*/
/* Includes ----------------------------------------------------------------- */
#include "attrTask.h"
/* Private typedef ---------------------------------------------------------- */
/* Private define ----------------------------------------------------------- */
/* Private macro ------------------------------------------------------------ */
/* Private variables -------------------------------------------------------- */
/* Private function --------------------------------------------------------- */
/* Exported functions ------------------------------------------------------- */
/**
* \brief 初始化
*
* \param argument 未使用
*/
void Task_Init(void *argument) {
(void)argument; /* 未使用argument消除警告 */
// Config_Get(&task_runtime.cfg); /* 获取机器人配置 */
osKernelLock();
/* 任务 */
// led
task_runtime.thread.led =
osThreadNew(Task_Led, NULL, &attr_led);
//can
task_runtime.thread.can =
osThreadNew(Task_Can, NULL, &attr_can);
// dji_motor
task_runtime.thread.dji_motor =
osThreadNew(Task_Motor, NULL, &attr_motor);
// odrive_shoot
task_runtime.thread.shoot =
osThreadNew(Task_Shoot, NULL, &attr_shoot);
// go
task_runtime.thread.go =
osThreadNew(Task_Go, NULL, &attr_go);
// nuc
task_runtime.thread.nuc =
osThreadNew(Task_nuc, NULL, &attr_nuc);
// rc
task_runtime.thread.rc =
osThreadNew(Task_Rc, NULL, &attr_rc);
/* 消息队列 */
//can
// task_runtime.queue.can.feedback.chassis =
// osMessageQueueNew(1u, sizeof(CAN_ChassisMotor_t), NULL);
// task_runtime.queue.can.feedback.gimbal =
// osMessageQueueNew(1u, sizeof(CAN_GimbalMotor_t), NULL);
// task_runtime.queue.feedback_left=
// osMessageQueueNew(1u, sizeof(Parsing_Data_t), NULL);
// task_runtime.queue.feedback_right =
// osMessageQueueNew(1u, sizeof(Parsing_Data_t), NULL);
// task_runtime.queue.cmd_left=
// osMessageQueueNew(1u, sizeof(CMD_gimbal_t), NULL);
// task_runtime.queue.cmd_right =
// osMessageQueueNew(1u, sizeof(CMD_gimbal_t), NULL);
/* 互斥量 */
// task_runtime.mutex.can.er_2 =
// xSemaphoreCreateMutex();
//
// task_runtime.mutex.cmd_left =
// xSemaphoreCreateMutex();
// task_runtime.mutex.cmd_right =
// xSemaphoreCreateMutex();
// task_runtime.mutex.feedback_left =
// xSemaphoreCreateMutex();
// task_runtime.mutex.feedback_right =
// xSemaphoreCreateMutex();
osKernelUnlock();
osThreadTerminate(osThreadGetId()); /* 结束自身 */
}