From b381d054e2801f2919b8a2c94ff7183694b3f683 Mon Sep 17 00:00:00 2001 From: tianjialong Date: Tue, 7 Mar 2023 10:55:11 +0800 Subject: [PATCH] update --- usersrc/usermain.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/usersrc/usermain.c b/usersrc/usermain.c index 28f29ae..bb6b421 100644 --- a/usersrc/usermain.c +++ b/usersrc/usermain.c @@ -100,13 +100,16 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim) { - if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_1) + if (htim == &htim4) { - printf("channel 1\r\n"); - } - else if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_2) - { - printf("channel 2\r\n"); + if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_1) + { + printf("tim4 channel 1\r\n"); + } + else if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_2) + { + printf("tim4 channel 2\r\n"); + } } } @@ -115,8 +118,8 @@ void user_main() printf("==============ethernet_sound_acquisition_card=============\r\n"); printf("version %d.%d", VERSION_MAIN_ID, VERSION_SUB_ID); - HAL_TIM_IC_Start_IT(&htim4, TIM_CHANNEL_1); //开启输入捕获中断 - HAL_TIM_IC_Start_IT(&htim4, TIM_CHANNEL_2); //开启输入捕获中断 + HAL_TIM_IC_Start_IT(&htim4, TIM_CHANNEL_1); // 开启输入捕获中断 + HAL_TIM_IC_Start_IT(&htim4, TIM_CHANNEL_2); // 开启输入捕获中断 // encoder_all_start(); // udp_client_init();