diff --git a/CMakeLists.txt b/CMakeLists.txt index 094b935..691a4fc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -167,6 +167,7 @@ target_sources(${CMAKE_PROJECT_NAME} PRIVATE User_Code/bsp/spi/bsp_spi.c User_Code/bsp/delayticks/delayticks.c User_Code/module/periph/ws2812/ws2812.c + User_Code/application/indicator_app/ws2812status.c # Add user sources here ) @@ -177,6 +178,7 @@ target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE User_Code/bsp/delayticks User_Code/module/periph/ws2812 User_Code/module/paramdef + User_Code/application/indicator_app # Add user defined include paths ) diff --git a/Core/Src/freertos.c b/Core/Src/freertos.c index af631f1..8c62fa1 100644 --- a/Core/Src/freertos.c +++ b/Core/Src/freertos.c @@ -25,7 +25,7 @@ /* Private includes ----------------------------------------------------------*/ /* USER CODE BEGIN Includes */ - +#include "ws2812status.h" /* USER CODE END Includes */ /* Private typedef -----------------------------------------------------------*/ @@ -117,45 +117,55 @@ const osThreadAttr_t WS2812Task_attributes = { /* USER CODE END FunctionPrototypes */ void StartDefaultTask(void *argument); + void ShootTask(void *argument); + void GimbalTask(void *argument); + void ChassisTask(void *argument); + void StartInitTask(void *argument); + void VisionTask(void *argument); + void CmdTask(void *argument); + void RefereeTask(void *argument); -extern void ws2812Task(void *argument); + +extern void ws2812Task(void const *argument); extern void MX_USB_DEVICE_Init(void); + void MX_FREERTOS_Init(void); /* (MISRA C 2004 rule 8.1) */ /* Hook prototypes */ void vApplicationStackOverflowHook(xTaskHandle xTask, signed char *pcTaskName); + void vApplicationMallocFailedHook(void); /* USER CODE BEGIN 4 */ -void vApplicationStackOverflowHook(xTaskHandle xTask, signed char *pcTaskName) -{ - /* Run time stack overflow checking is performed if - configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook function is - called if a stack overflow is detected. */ +void vApplicationStackOverflowHook(xTaskHandle xTask, signed char *pcTaskName) { + /* Run time stack overflow checking is performed if + configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook function is + called if a stack overflow is detected. */ } + /* USER CODE END 4 */ /* USER CODE BEGIN 5 */ -void vApplicationMallocFailedHook(void) -{ - /* vApplicationMallocFailedHook() will only be called if - configUSE_MALLOC_FAILED_HOOK is set to 1 in FreeRTOSConfig.h. It is a hook - function that will get called if a call to pvPortMalloc() fails. - pvPortMalloc() is called internally by the kernel whenever a task, queue, - timer or semaphore is created. It is also called by various parts of the - demo application. If heap_1.c or heap_2.c are used, then the size of the - heap available to pvPortMalloc() is defined by configTOTAL_HEAP_SIZE in - FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used - to query the size of free heap space that remains (although it does not - provide information on how the remaining heap might be fragmented). */ +void vApplicationMallocFailedHook(void) { + /* vApplicationMallocFailedHook() will only be called if + configUSE_MALLOC_FAILED_HOOK is set to 1 in FreeRTOSConfig.h. It is a hook + function that will get called if a call to pvPortMalloc() fails. + pvPortMalloc() is called internally by the kernel whenever a task, queue, + timer or semaphore is created. It is also called by various parts of the + demo application. If heap_1.c or heap_2.c are used, then the size of the + heap available to pvPortMalloc() is defined by configTOTAL_HEAP_SIZE in + FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used + to query the size of free heap space that remains (although it does not + provide information on how the remaining heap might be fragmented). */ } + /* USER CODE END 5 */ /** @@ -219,7 +229,6 @@ void MX_FREERTOS_Init(void) { /* USER CODE BEGIN RTOS_EVENTS */ /* add events, ... */ /* USER CODE END RTOS_EVENTS */ - } /* USER CODE BEGIN Header_StartDefaultTask */ @@ -229,14 +238,12 @@ void MX_FREERTOS_Init(void) { * @retval None */ /* USER CODE END Header_StartDefaultTask */ -__weak void StartDefaultTask(void *argument) -{ +__weak void StartDefaultTask(void *argument) { /* init code for USB_DEVICE */ MX_USB_DEVICE_Init(); /* USER CODE BEGIN StartDefaultTask */ /* Infinite loop */ - for(;;) - { + for (;;) { osDelay(1); } /* USER CODE END StartDefaultTask */ @@ -249,12 +256,10 @@ __weak void StartDefaultTask(void *argument) * @retval None */ /* USER CODE END Header_ShootTask */ -__weak void ShootTask(void *argument) -{ +__weak void ShootTask(void *argument) { /* USER CODE BEGIN ShootTask */ /* Infinite loop */ - for(;;) - { + for (;;) { osDelay(1); } /* USER CODE END ShootTask */ @@ -267,12 +272,10 @@ __weak void ShootTask(void *argument) * @retval None */ /* USER CODE END Header_GimbalTask */ -__weak void GimbalTask(void *argument) -{ +__weak void GimbalTask(void *argument) { /* USER CODE BEGIN GimbalTask */ /* Infinite loop */ - for(;;) - { + for (;;) { osDelay(1); } /* USER CODE END GimbalTask */ @@ -285,12 +288,10 @@ __weak void GimbalTask(void *argument) * @retval None */ /* USER CODE END Header_ChassisTask */ -__weak void ChassisTask(void *argument) -{ +__weak void ChassisTask(void *argument) { /* USER CODE BEGIN ChassisTask */ /* Infinite loop */ - for(;;) - { + for (;;) { osDelay(1); } /* USER CODE END ChassisTask */ @@ -303,12 +304,10 @@ __weak void ChassisTask(void *argument) * @retval None */ /* USER CODE END Header_StartInitTask */ -__weak void StartInitTask(void *argument) -{ +__weak void StartInitTask(void *argument) { /* USER CODE BEGIN StartInitTask */ /* Infinite loop */ - for(;;) - { + for (;;) { osDelay(1); } /* USER CODE END StartInitTask */ @@ -321,12 +320,10 @@ __weak void StartInitTask(void *argument) * @retval None */ /* USER CODE END Header_VisionTask */ -__weak void VisionTask(void *argument) -{ +__weak void VisionTask(void *argument) { /* USER CODE BEGIN VisionTask */ /* Infinite loop */ - for(;;) - { + for (;;) { osDelay(1); } /* USER CODE END VisionTask */ @@ -339,12 +336,10 @@ __weak void VisionTask(void *argument) * @retval None */ /* USER CODE END Header_CmdTask */ -__weak void CmdTask(void *argument) -{ +__weak void CmdTask(void *argument) { /* USER CODE BEGIN CmdTask */ /* Infinite loop */ - for(;;) - { + for (;;) { osDelay(1); } /* USER CODE END CmdTask */ @@ -357,12 +352,10 @@ __weak void CmdTask(void *argument) * @retval None */ /* USER CODE END Header_RefereeTask */ -__weak void RefereeTask(void *argument) -{ +__weak void RefereeTask(void *argument) { /* USER CODE BEGIN RefereeTask */ /* Infinite loop */ - for(;;) - { + for (;;) { osDelay(1); } /* USER CODE END RefereeTask */ diff --git a/User_Code/application/indicator_app/ws2812status.c b/User_Code/application/indicator_app/ws2812status.c index 7ca6064..bb86bce 100644 --- a/User_Code/application/indicator_app/ws2812status.c +++ b/User_Code/application/indicator_app/ws2812status.c @@ -35,7 +35,7 @@ uint8_t b = 0; * @brief WS2812 LED control task * @param argument */ -void ws2812Task(void const *argument) { +void ws2812Task(void const * argument) { while (1) { switch (RobotMode) { case NORMAL_MODE: diff --git a/User_Code/application/indicator_app/ws2812status.h b/User_Code/application/indicator_app/ws2812status.h index d803b2a..76b4ac7 100644 --- a/User_Code/application/indicator_app/ws2812status.h +++ b/User_Code/application/indicator_app/ws2812status.h @@ -8,7 +8,7 @@ #include "ws2812.h" /*---------------------FUNCTIONS---------------------*/ -void ws2812Task(void const *argument); +extern void ws2812Task(void const *argument); void BlinkYellow(void);