第一次提交

This commit is contained in:
2026-07-14 18:41:03 +08:00
commit c4e1ed7a3d
141 changed files with 157812 additions and 0 deletions

158
Core/Src/freertos.c Normal file
View File

@@ -0,0 +1,158 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* File Name : freertos.c
* Description : Code for freertos applications
******************************************************************************
* @attention
*
* Copyright (c) 2026 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.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Includes ------------------------------------------------------------------*/
#include "FreeRTOS.h"
#include "task.h"
#include "main.h"
#include "cmsis_os.h"
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
/* 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 */
/* USER CODE END Variables */
/* Definitions for CAN_Receive_Tas */
osThreadId_t CAN_Receive_TasHandle;
const osThreadAttr_t CAN_Receive_Tas_attributes = {
.name = "CAN_Receive_Tas",
.stack_size = 128 * 4,
.priority = (osPriority_t) osPriorityHigh,
};
/* Definitions for Chassis_Control */
osThreadId_t Chassis_ControlHandle;
const osThreadAttr_t Chassis_Control_attributes = {
.name = "Chassis_Control",
.stack_size = 128 * 4,
.priority = (osPriority_t) osPriorityNormal,
};
/* Private function prototypes -----------------------------------------------*/
/* USER CODE BEGIN FunctionPrototypes */
/* USER CODE END FunctionPrototypes */
void StartCAN_Receive_Task(void *argument);
void StartChassis_Control_Task(void *argument);
void MX_FREERTOS_Init(void); /* (MISRA C 2004 rule 8.1) */
/**
* @brief FreeRTOS initialization
* @param None
* @retval None
*/
void MX_FREERTOS_Init(void) {
/* 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) */
/* creation of CAN_Receive_Tas */
CAN_Receive_TasHandle = osThreadNew(StartCAN_Receive_Task, NULL, &CAN_Receive_Tas_attributes);
/* creation of Chassis_Control */
Chassis_ControlHandle = osThreadNew(StartChassis_Control_Task, NULL, &Chassis_Control_attributes);
/* USER CODE BEGIN RTOS_THREADS */
/* add threads, ... */
/* USER CODE END RTOS_THREADS */
/* USER CODE BEGIN RTOS_EVENTS */
/* add events, ... */
/* USER CODE END RTOS_EVENTS */
}
/* USER CODE BEGIN Header_StartCAN_Receive_Task */
/**
* @brief Function implementing the CAN_Receive_Tas thread.
* @param argument: Not used
* @retval None
*/
/* USER CODE END Header_StartCAN_Receive_Task */
void StartCAN_Receive_Task(void *argument)
{
/* USER CODE BEGIN StartCAN_Receive_Task */
/* Infinite loop */
for(;;)
{
osDelay(1);
}
/* USER CODE END StartCAN_Receive_Task */
}
/* USER CODE BEGIN Header_StartChassis_Control_Task */
/**
* @brief Function implementing the Chassis_Control thread.
* @param argument: Not used
* @retval None
*/
/* USER CODE END Header_StartChassis_Control_Task */
void StartChassis_Control_Task(void *argument)
{
/* USER CODE BEGIN StartChassis_Control_Task */
/* Infinite loop */
for(;;)
{
osDelay(1);
}
/* USER CODE END StartChassis_Control_Task */
}
/* Private application code --------------------------------------------------*/
/* USER CODE BEGIN Application */
/* USER CODE END Application */