From 4d20dfbc494d82f9c72df6ceb7597f09ce74ca07 Mon Sep 17 00:00:00 2001 From: wangxujie <390834610@qq.com> Date: Mon, 21 Apr 2025 08:30:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=87=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Core/Src/freertos.c | 26 ++++----- Core/Src/gpio.c | 4 +- Core/Src/main.c | 64 ++++++++++----------- MDK-ARM/valve_debugging.uvoptx | 18 +----- MDK-ARM/valve_debugging/valve_debugging.hex | 4 +- valve_debugging.ioc | 4 +- 6 files changed, 52 insertions(+), 68 deletions(-) diff --git a/Core/Src/freertos.c b/Core/Src/freertos.c index 03beb93..39e9dda 100644 --- a/Core/Src/freertos.c +++ b/Core/Src/freertos.c @@ -58,15 +58,15 @@ osThreadId ch438_taskHandle; /* USER CODE END FunctionPrototypes */ -void start_lwip_task(void const *argument); -void start_dac_task(void const *argument); -void start_ch438_task(void const *argument); +void start_lwip_task(void const * argument); +void start_dac_task(void const * argument); +void start_ch438_task(void const * argument); extern void MX_LWIP_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; @@ -82,12 +82,11 @@ void vApplicationGetIdleTaskMemory(StaticTask_t **ppxIdleTaskTCBBuffer, StackTyp /* 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 */ @@ -124,6 +123,7 @@ void MX_FREERTOS_Init(void) /* USER CODE BEGIN RTOS_THREADS */ /* add threads, ... */ /* USER CODE END RTOS_THREADS */ + } /* USER CODE BEGIN Header_start_lwip_task */ @@ -133,7 +133,7 @@ void MX_FREERTOS_Init(void) * @retval None */ /* USER CODE END Header_start_lwip_task */ -void start_lwip_task(void const *argument) +void start_lwip_task(void const * argument) { /* init code for LWIP */ MX_LWIP_Init(); @@ -158,7 +158,7 @@ void start_lwip_task(void const *argument) * @retval None */ /* USER CODE END Header_start_dac_task */ -void start_dac_task(void const *argument) +void start_dac_task(void const * argument) { /* USER CODE BEGIN start_dac_task */ /* Infinite loop */ @@ -182,7 +182,7 @@ void start_dac_task(void const *argument) * @retval None */ /* USER CODE END Header_start_ch438_task */ -void start_ch438_task(void const *argument) +void start_ch438_task(void const * argument) { /* USER CODE BEGIN start_ch438_task */ /* Infinite loop */ diff --git a/Core/Src/gpio.c b/Core/Src/gpio.c index 15a6177..c64aa1c 100644 --- a/Core/Src/gpio.c +++ b/Core/Src/gpio.c @@ -162,10 +162,10 @@ void MX_GPIO_Init(void) HAL_GPIO_Init(CH438_1_INT_GPIO_Port, &GPIO_InitStruct); /* EXTI interrupt init*/ - HAL_NVIC_SetPriority(EXTI2_IRQn, 6, 0); + HAL_NVIC_SetPriority(EXTI2_IRQn, 4, 0); HAL_NVIC_EnableIRQ(EXTI2_IRQn); - HAL_NVIC_SetPriority(EXTI15_10_IRQn, 6, 0); + HAL_NVIC_SetPriority(EXTI15_10_IRQn, 4, 0); HAL_NVIC_EnableIRQ(EXTI15_10_IRQn); } diff --git a/Core/Src/main.c b/Core/Src/main.c index 5bed399..b4921c3 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -65,9 +65,9 @@ void MX_FREERTOS_Init(void); /* USER CODE END 0 */ /** - * @brief The application entry point. - * @retval int - */ + * @brief The application entry point. + * @retval int + */ int main(void) { /* USER CODE BEGIN 1 */ @@ -119,22 +119,22 @@ int main(void) } /** - * @brief System Clock Configuration - * @retval None - */ + * @brief System Clock Configuration + * @retval None + */ void SystemClock_Config(void) { RCC_OscInitTypeDef RCC_OscInitStruct = {0}; RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; /** Configure the main internal regulator output voltage - */ + */ __HAL_RCC_PWR_CLK_ENABLE(); __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); /** Initializes the RCC Oscillators according to the specified parameters - * in the RCC_OscInitTypeDef structure. - */ + * in the RCC_OscInitTypeDef structure. + */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; @@ -149,8 +149,9 @@ void SystemClock_Config(void) } /** Initializes the CPU, AHB and APB buses clocks - */ - RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2; + */ + RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK + |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4; @@ -167,32 +168,31 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) { if (CH438_1_INT_Pin == GPIO_Pin) { - // ch438_1_int_flag = 1; // 设置CH438_1的中断标志,用于中断处理函数中判断是否为CH438_1的中断请求 + // ch438_1_int_flag = 1; // 设置CH438_1的中断标志,用于中断处理函数中判断是否为CH438_1的中断请? ch438_interrupt_handler_ch438_chip_1(); } if (CH438_2_INT_Pin == GPIO_Pin) { - // ch438_2_int_flag = 1; // 设置CH438_1的中断标志,用于中断处理函数中判断是否为CH438_1的中断请求 + // ch438_2_int_flag = 1; // 设置CH438_1的中断标志,用于中断处理函数中判断是否为CH438_1的中断请? ch438_interrupt_handler_ch438_chip_2(); } } /* USER CODE END 4 */ /** - * @brief Period elapsed callback in non blocking mode - * @note This function is called when TIM4 interrupt took place, inside - * HAL_TIM_IRQHandler(). It makes a direct call to HAL_IncTick() to increment - * a global variable "uwTick" used as application time base. - * @param htim : TIM handle - * @retval None - */ + * @brief Period elapsed callback in non blocking mode + * @note This function is called when TIM4 interrupt took place, inside + * HAL_TIM_IRQHandler(). It makes a direct call to HAL_IncTick() to increment + * a global variable "uwTick" used as application time base. + * @param htim : TIM handle + * @retval None + */ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) { /* USER CODE BEGIN Callback 0 */ /* USER CODE END Callback 0 */ - if (htim->Instance == TIM4) - { + if (htim->Instance == TIM4) { HAL_IncTick(); } /* USER CODE BEGIN Callback 1 */ @@ -201,9 +201,9 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) } /** - * @brief This function is executed in case of error occurrence. - * @retval None - */ + * @brief This function is executed in case of error occurrence. + * @retval None + */ void Error_Handler(void) { /* USER CODE BEGIN Error_Handler_Debug */ @@ -215,14 +215,14 @@ void Error_Handler(void) /* USER CODE END Error_Handler_Debug */ } -#ifdef USE_FULL_ASSERT +#ifdef USE_FULL_ASSERT /** - * @brief Reports the name of the source file and the source line number - * where the assert_param error has occurred. - * @param file: pointer to the source file name - * @param line: assert_param error line source number - * @retval None - */ + * @brief Reports the name of the source file and the source line number + * where the assert_param error has occurred. + * @param file: pointer to the source file name + * @param line: assert_param error line source number + * @retval None + */ void assert_failed(uint8_t *file, uint32_t line) { /* USER CODE BEGIN 6 */ diff --git a/MDK-ARM/valve_debugging.uvoptx b/MDK-ARM/valve_debugging.uvoptx index 121f93c..a0626f0 100644 --- a/MDK-ARM/valve_debugging.uvoptx +++ b/MDK-ARM/valve_debugging.uvoptx @@ -168,22 +168,6 @@ 1 0 - 36 - 1 -
134290996
- 0 - 0 - 0 - 0 - 0 - 1 - ..\User\application\src\tcpserverc.c - - \\valve_debugging\../User/application/src/tcpserverc.c\36 -
- - 2 - 0 142 1
0
@@ -193,7 +177,7 @@ 0 0 0 - ../Core/Src/freertos.c + startup_stm32f407xx.s
diff --git a/MDK-ARM/valve_debugging/valve_debugging.hex b/MDK-ARM/valve_debugging/valve_debugging.hex index 91b38bf..dea889a 100644 --- a/MDK-ARM/valve_debugging/valve_debugging.hex +++ b/MDK-ARM/valve_debugging/valve_debugging.hex @@ -824,8 +824,8 @@ :1033600004900320059002A91B48FEF7FBF94FF4D7 :10337000006002900120039004900320059002A9B0 :103380001648FEF7EFF9042002904FF40410039062 -:103390000120049002A91048FEF7E4F9002206215A -:1033A0000820FEF7B9FB0820FEF7A6FB0022062145 +:103390000120049002A91048FEF7E4F9002204215C +:1033A0000820FEF7B9FB0820FEF7A6FB0022042147 :1033B0002820FEF7B1FB2820FEF79EFB07B000BDDA :1033C0003038024000100240001402400000024069 :1033D0000004024000180240000C024000080240B5 diff --git a/valve_debugging.ioc b/valve_debugging.ioc index e0f5c78..705f7fe 100644 --- a/valve_debugging.ioc +++ b/valve_debugging.ioc @@ -154,8 +154,8 @@ MxDb.Version=DB.6.0.92 NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false NVIC.ETH_IRQn=true\:6\:0\:true\:false\:true\:true\:false\:true\:true -NVIC.EXTI15_10_IRQn=true\:6\:0\:true\:false\:true\:true\:true\:true\:true -NVIC.EXTI2_IRQn=true\:6\:0\:true\:false\:true\:true\:true\:true\:true +NVIC.EXTI15_10_IRQn=true\:4\:0\:true\:false\:true\:false\:true\:true\:true +NVIC.EXTI2_IRQn=true\:4\:0\:true\:false\:true\:false\:true\:true\:true NVIC.ForceEnableDMAVector=true NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false