MiaoUI/User/main.c

61 lines
1.1 KiB
C
Raw Normal View History

2023-06-30 04:50:02 +00:00
#include "main.h"
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
TaskHandle_t AppTaskCreate_Handle;
void Init(void);
static void AppTaskCreate(void);
2023-06-30 09:53:48 +00:00
2023-06-30 04:50:02 +00:00
int main(void)
{
BaseType_t xReturn = pdPASS;
Init();
xReturn=xTaskCreate((TaskFunction_t)AppTaskCreate,"AppTaskCreate",128,NULL,3,&AppTaskCreate_Handle);
if (pdPASS==xReturn)
{
printf("/******Menu is Successfully loaded!******/\r\n");
2023-06-30 04:50:02 +00:00
}
vTaskStartScheduler();
while(1);
}
void Init(void)
{
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);
USART_Config();
// Timer_Init();
2023-06-30 04:50:02 +00:00
LED_GPIO_Config();
2023-07-13 15:32:01 +00:00
Menu_Init();
KEY_GPIO_Config();
Key_Loading();
2023-06-30 04:50:02 +00:00
}
TaskHandle_t test_handle;
void test_(void *parameter)
{
while (1)
{
printf("test\r\n");
}
}
2023-06-30 04:50:02 +00:00
static void AppTaskCreate(void)
{
taskENTER_CRITICAL(); //进入临界区
2023-06-30 09:53:48 +00:00
/* 创建任务 */
xTaskCreate((TaskFunction_t)test_,"test",128,NULL,5,test_handle);
Menu_Task_Create();
KeyScan_Task_Create();
2023-06-30 04:50:02 +00:00
vTaskDelete(AppTaskCreate_Handle); //删除AppTaskCreate任务
taskEXIT_CRITICAL(); //退出临界区
}