2022-10-20 17:13:02 +08:00
|
|
|
/* USER CODE BEGIN Header */
|
|
|
|
/**
|
2023-04-19 18:52:40 +08:00
|
|
|
******************************************************************************
|
|
|
|
* File Name : freertos.c
|
|
|
|
* Description : Code for freertos applications
|
|
|
|
******************************************************************************
|
|
|
|
* @attention
|
|
|
|
*
|
|
|
|
* Copyright (c) 2023 STMicroelectronics.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This software is licensed under terms that can be found in the LICENSE file
|
|
|
|
* in the root directory of this software component.
|
|
|
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
|
|
|
*
|
|
|
|
******************************************************************************
|
|
|
|
*/
|
2022-10-20 17:13:02 +08:00
|
|
|
/* USER CODE END Header */
|
|
|
|
|
|
|
|
/* Includes ------------------------------------------------------------------*/
|
|
|
|
#include "FreeRTOS.h"
|
|
|
|
#include "task.h"
|
|
|
|
#include "main.h"
|
|
|
|
#include "cmsis_os.h"
|
|
|
|
|
|
|
|
/* Private includes ----------------------------------------------------------*/
|
|
|
|
/* USER CODE BEGIN Includes */
|
2023-06-05 22:43:25 +08:00
|
|
|
|
2022-10-20 17:13:02 +08:00
|
|
|
/* USER CODE END Includes */
|
|
|
|
|
|
|
|
/* Private typedef -----------------------------------------------------------*/
|
|
|
|
/* USER CODE BEGIN PTD */
|
|
|
|
|
|
|
|
/* USER CODE END PTD */
|
|
|
|
|
|
|
|
/* Private define ------------------------------------------------------------*/
|
|
|
|
/* USER CODE BEGIN PD */
|
|
|
|
|
|
|
|
/* USER CODE END PD */
|
|
|
|
|
|
|
|
/* Private macro -------------------------------------------------------------*/
|
|
|
|
/* USER CODE BEGIN PM */
|
|
|
|
|
|
|
|
/* USER CODE END PM */
|
|
|
|
|
|
|
|
/* Private variables ---------------------------------------------------------*/
|
|
|
|
/* USER CODE BEGIN Variables */
|
2023-06-05 22:43:25 +08:00
|
|
|
|
2023-04-24 07:11:19 +08:00
|
|
|
/* USER CODE END Variables */
|
|
|
|
osThreadId defaultTaskHandle;
|
2022-10-20 17:13:02 +08:00
|
|
|
|
|
|
|
/* Private function prototypes -----------------------------------------------*/
|
|
|
|
/* USER CODE BEGIN FunctionPrototypes */
|
2022-12-08 17:36:12 +08:00
|
|
|
|
2022-10-20 17:13:02 +08:00
|
|
|
/* USER CODE END FunctionPrototypes */
|
|
|
|
|
2023-05-29 09:48:07 +08:00
|
|
|
void StartDefaultTask(void const *argument);
|
2022-10-20 17:13:02 +08:00
|
|
|
|
|
|
|
extern void MX_USB_DEVICE_Init(void);
|
|
|
|
void MX_FREERTOS_Init(void); /* (MISRA C 2004 rule 8.1) */
|
|
|
|
|
|
|
|
/* GetIdleTaskMemory prototype (linked to static allocation support) */
|
2023-05-29 09:48:07 +08:00
|
|
|
void vApplicationGetIdleTaskMemory(StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize);
|
2022-10-20 17:13:02 +08:00
|
|
|
|
|
|
|
/* USER CODE BEGIN GET_IDLE_TASK_MEMORY */
|
|
|
|
static StaticTask_t xIdleTaskTCBBuffer;
|
|
|
|
static StackType_t xIdleStack[configMINIMAL_STACK_SIZE];
|
|
|
|
|
2023-04-19 18:52:40 +08:00
|
|
|
void vApplicationGetIdleTaskMemory(StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize)
|
2022-10-20 17:13:02 +08:00
|
|
|
{
|
|
|
|
*ppxIdleTaskTCBBuffer = &xIdleTaskTCBBuffer;
|
|
|
|
*ppxIdleTaskStackBuffer = &xIdleStack[0];
|
|
|
|
*pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;
|
|
|
|
/* place for user code */
|
|
|
|
}
|
|
|
|
/* USER CODE END GET_IDLE_TASK_MEMORY */
|
|
|
|
|
|
|
|
/**
|
2023-05-29 09:48:07 +08:00
|
|
|
* @brief FreeRTOS initialization
|
|
|
|
* @param None
|
|
|
|
* @retval None
|
|
|
|
*/
|
|
|
|
void MX_FREERTOS_Init(void)
|
|
|
|
{
|
2022-10-20 17:13:02 +08:00
|
|
|
/* USER CODE BEGIN Init */
|
|
|
|
|
|
|
|
/* USER CODE END Init */
|
|
|
|
|
|
|
|
/* USER CODE BEGIN RTOS_MUTEX */
|
|
|
|
/* add mutexes, ... */
|
|
|
|
/* USER CODE END RTOS_MUTEX */
|
|
|
|
|
|
|
|
/* USER CODE BEGIN RTOS_SEMAPHORES */
|
|
|
|
/* add semaphores, ... */
|
|
|
|
/* USER CODE END RTOS_SEMAPHORES */
|
|
|
|
|
|
|
|
/* USER CODE BEGIN RTOS_TIMERS */
|
|
|
|
/* start timers, add new ones, ... */
|
|
|
|
/* USER CODE END RTOS_TIMERS */
|
|
|
|
|
|
|
|
/* USER CODE BEGIN RTOS_QUEUES */
|
|
|
|
/* add queues, ... */
|
|
|
|
/* USER CODE END RTOS_QUEUES */
|
|
|
|
|
|
|
|
/* Create the thread(s) */
|
|
|
|
/* definition and creation of defaultTask */
|
|
|
|
osThreadDef(defaultTask, StartDefaultTask, osPriorityNormal, 0, 128);
|
|
|
|
defaultTaskHandle = osThreadCreate(osThread(defaultTask), NULL);
|
2023-04-13 11:33:31 +08:00
|
|
|
|
|
|
|
/* USER CODE BEGIN RTOS_THREADS */
|
|
|
|
/* add threads, ... */
|
|
|
|
|
2023-04-19 18:52:40 +08:00
|
|
|
/* USER CODE END RTOS_THREADS */
|
2022-10-20 17:13:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* USER CODE BEGIN Header_StartDefaultTask */
|
|
|
|
/**
|
2023-04-19 18:52:40 +08:00
|
|
|
* @brief Function implementing the defaultTask thread.
|
|
|
|
* @param argument: Not used
|
|
|
|
* @retval None
|
|
|
|
*/
|
2022-10-20 17:13:02 +08:00
|
|
|
/* USER CODE END Header_StartDefaultTask */
|
2023-05-29 09:48:07 +08:00
|
|
|
void StartDefaultTask(void const *argument)
|
2022-10-20 17:13:02 +08:00
|
|
|
{
|
|
|
|
/* init code for USB_DEVICE */
|
2023-06-14 20:07:39 +08:00
|
|
|
MX_USB_DEVICE_Init(); // USB???
|
2022-10-20 17:13:02 +08:00
|
|
|
/* USER CODE BEGIN StartDefaultTask */
|
2023-06-14 20:07:39 +08:00
|
|
|
vTaskDelete(NULL); // ??????,????CPU
|
2022-10-20 17:13:02 +08:00
|
|
|
/* USER CODE END StartDefaultTask */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Private application code --------------------------------------------------*/
|
|
|
|
/* USER CODE BEGIN Application */
|
2023-06-05 22:43:25 +08:00
|
|
|
/**
|
2023-06-14 20:07:39 +08:00
|
|
|
* @brief ??,???????,
|
|
|
|
* ??????????applicatoin/robot_task.h???
|
2023-06-05 22:43:25 +08:00
|
|
|
*
|
|
|
|
*/
|
2022-10-20 17:13:02 +08:00
|
|
|
/* USER CODE END Application */
|