Refactor shell task creation
- Removed the shell task handle from app.c as it is no longer needed. - Moved the shell task creation to shell_port.c with updated parameters. - Ensured the shell task is created with appropriate stack size and priority.
This commit is contained in:
parent
c3b9daba20
commit
9f37c7d763
File diff suppressed because it is too large
Load Diff
|
|
@ -4,7 +4,6 @@
|
|||
#include "shell_port.h"
|
||||
|
||||
static TaskHandle_t business_task_handle = NULL;
|
||||
static TaskHandle_t shell_task_handle = NULL;
|
||||
|
||||
void business_task(void *pvParameters)
|
||||
{
|
||||
|
|
@ -29,12 +28,4 @@ void app_init(void)
|
|||
(void *)NULL, // 任务入口函数参数
|
||||
(UBaseType_t)1, // 任务优先级
|
||||
(TaskHandle_t *)&business_task_handle); // 任务句柄
|
||||
|
||||
extern Shell shell;
|
||||
xTaskCreate((TaskFunction_t)shellTask, // 任务入口函数
|
||||
(const char *)"shell_task", // 任务名字
|
||||
(uint16_t)1024, // 任务栈大小
|
||||
(void *)&shell, // 任务入口函数参数(传递 shell 对象指针)
|
||||
(UBaseType_t)1, // 任务优先级
|
||||
(TaskHandle_t *)&shell_task_handle); // 任务句柄
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,10 +108,13 @@ void userShellInit(void)
|
|||
|
||||
// 启动串口中断接收
|
||||
HAL_UART_Receive_IT(&huart1, &shell_uart_rx_temp, 1);
|
||||
// if (xTaskCreate(shellTask, "shell", 256, &shell, 5, NULL) != pdPASS)
|
||||
// {
|
||||
//// logError("shell task creat failed");
|
||||
// }
|
||||
|
||||
xTaskCreate((TaskFunction_t)shellTask, // 任务入口函数
|
||||
(const char *)"shell_task", // 任务名字
|
||||
(uint16_t)1024, // 任务栈大小
|
||||
(void *)&shell, // 任务入口函数参数(传递 shell 对象指针)
|
||||
(UBaseType_t)1, // 任务优先级
|
||||
NULL); // 任务句柄
|
||||
}
|
||||
|
||||
// 串口接收完成回调(在 usart.c 里实现也可)
|
||||
|
|
|
|||
Loading…
Reference in New Issue