mirror of
https://gitee.com/dlmu-cone/bf_original_balance_chassis
synced 2026-07-24 03:27:45 +08:00
合并“referee”分支
This commit is contained in:
106
Src/freertos.c
106
Src/freertos.c
@@ -1,20 +1,20 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
******************************************************************************
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "ins_task.h"
|
||||
#include "motor_task.h"
|
||||
#include "led_task.h"
|
||||
#include "referee_task.h"
|
||||
#include "daemon.h"
|
||||
#include "robot.h"
|
||||
/* USER CODE END Includes */
|
||||
@@ -61,28 +62,32 @@ osThreadId uiTaskHandle;
|
||||
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
/* USER CODE BEGIN FunctionPrototypes */
|
||||
void StartINSTASK(void const * argument);
|
||||
void StartINSTASK(void const *argument);
|
||||
|
||||
void StartMOTORTASK(void const * argument);
|
||||
void StartMOTORTASK(void const *argument);
|
||||
|
||||
void StartDAEMONTASK(void const* argument);
|
||||
void StartDAEMONTASK(void const *argument);
|
||||
|
||||
void StartROBOTTASK(void const* argument);
|
||||
void StartROBOTTASK(void const *argument);
|
||||
|
||||
void StartROBOTTASK(void const *argument);
|
||||
|
||||
void StartUITASK(void const *argument);
|
||||
/* USER CODE END FunctionPrototypes */
|
||||
|
||||
void StartDefaultTask(void const * argument);
|
||||
void StartDefaultTask(void const *argument);
|
||||
|
||||
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) */
|
||||
void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize );
|
||||
void vApplicationGetIdleTaskMemory(StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize);
|
||||
|
||||
/* USER CODE BEGIN GET_IDLE_TASK_MEMORY */
|
||||
static StaticTask_t xIdleTaskTCBBuffer;
|
||||
static StackType_t xIdleStack[configMINIMAL_STACK_SIZE];
|
||||
|
||||
void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize )
|
||||
void vApplicationGetIdleTaskMemory(StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize)
|
||||
{
|
||||
*ppxIdleTaskTCBBuffer = &xIdleTaskTCBBuffer;
|
||||
*ppxIdleTaskStackBuffer = &xIdleStack[0];
|
||||
@@ -92,11 +97,12 @@ void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackTy
|
||||
/* USER CODE END GET_IDLE_TASK_MEMORY */
|
||||
|
||||
/**
|
||||
* @brief FreeRTOS initialization
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void MX_FREERTOS_Init(void) {
|
||||
* @brief FreeRTOS initialization
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void MX_FREERTOS_Init(void)
|
||||
{
|
||||
/* USER CODE BEGIN Init */
|
||||
|
||||
/* USER CODE END Init */
|
||||
@@ -134,25 +140,28 @@ void MX_FREERTOS_Init(void) {
|
||||
daemonTaskHandle = osThreadCreate(osThread(daemontask), NULL);
|
||||
|
||||
osThreadDef(robottask, StartROBOTTASK, osPriorityNormal, 0, 1024);
|
||||
robotTaskHandle = osThreadCreate(osThread(robottask), NULL);
|
||||
/* USER CODE END RTOS_THREADS */
|
||||
defaultTaskHandle = osThreadCreate(osThread(robottask), NULL);
|
||||
|
||||
osThreadDef(uitask, StartUITASK, osPriorityNormal, 0, 512);
|
||||
defaultTaskHandle = osThreadCreate(osThread(uitask), NULL);
|
||||
|
||||
/* USER CODE END RTOS_THREADS */
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN Header_StartDefaultTask */
|
||||
/**
|
||||
* @brief Function implementing the defaultTask thread.
|
||||
* @param argument: Not used
|
||||
* @retval None
|
||||
*/
|
||||
* @brief Function implementing the defaultTask thread.
|
||||
* @param argument: Not used
|
||||
* @retval None
|
||||
*/
|
||||
/* USER CODE END Header_StartDefaultTask */
|
||||
void StartDefaultTask(void const * argument)
|
||||
void StartDefaultTask(void const *argument)
|
||||
{
|
||||
/* init code for USB_DEVICE */
|
||||
MX_USB_DEVICE_Init();
|
||||
/* USER CODE BEGIN StartDefaultTask */
|
||||
/* Infinite loop */
|
||||
for(;;)
|
||||
for (;;)
|
||||
{
|
||||
osDelay(1);
|
||||
}
|
||||
@@ -161,43 +170,52 @@ void StartDefaultTask(void const * argument)
|
||||
|
||||
/* Private application code --------------------------------------------------*/
|
||||
/* USER CODE BEGIN Application */
|
||||
void StartINSTASK(void const * argument)
|
||||
void StartINSTASK(void const *argument)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
//1kHz
|
||||
INS_Task();
|
||||
// 1kHz
|
||||
// INS_Task();
|
||||
osDelay(1);
|
||||
}
|
||||
}
|
||||
|
||||
void StartMOTORTASK(void const * argument)
|
||||
void StartMOTORTASK(void const *argument)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
//500Hz
|
||||
// 500Hz
|
||||
MotorControlTask();
|
||||
osDelay(2);
|
||||
}
|
||||
}
|
||||
|
||||
void StartDAEMONTASK(void const * argument)
|
||||
void StartDAEMONTASK(void const *argument)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
//100Hz
|
||||
// 100Hz
|
||||
DaemonTask();
|
||||
osDelay(10);
|
||||
}
|
||||
}
|
||||
|
||||
void StartROBOTTASK(void const * argument)
|
||||
void StartROBOTTASK(void const *argument)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
// 200Hz
|
||||
RobotTask();
|
||||
osDelay(5);//syh此处暂时将时间改<E997B4>?10ms,原因在于未使用缓冲区发送,发<EFBC8C>?<3F>时延时5ms
|
||||
osDelay(5); // syh此处暂时将时间改<EFBFBD>?10ms,原因在于未使用缓冲区发送,发<EFBC8C>?<3F>时延时5ms
|
||||
}
|
||||
}
|
||||
|
||||
void StartUITASK(void const *argument)
|
||||
{
|
||||
My_UI_init();
|
||||
while (1)
|
||||
{
|
||||
Referee_Interactive_task();
|
||||
}
|
||||
}
|
||||
/* USER CODE END Application */
|
||||
|
||||
Reference in New Issue
Block a user