From f03154b2f72ff805fcb8c2d0914c4286b43aa3dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B7=E5=BA=8A=E5=B0=B1=E7=8A=AF=E5=9B=B0?= <11730503+psx123456@user.noreply.gitee.com> Date: Fri, 10 Oct 2025 16:21:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=96=E6=B6=88422=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BSP/Driver/usart/Usart.c | 42 +++++++++---------- .../SYSTICK/gd32f4xx_it.c | 28 ++++++------- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/BSP/Driver/usart/Usart.c b/BSP/Driver/usart/Usart.c index 2d19e5f..3f83746 100644 --- a/BSP/Driver/usart/Usart.c +++ b/BSP/Driver/usart/Usart.c @@ -79,18 +79,18 @@ static void usart_config(uint32_t usart_periph, int baud) gpio_output_options_set(GPIOD, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ,GPIO_PIN_7); break; - case UART_422://串口2,422 - //使能端口时钟 - rcu_periph_clock_enable(RCU_GPIOD); - //使能串口时钟 - rcu_periph_clock_enable(RCU_USART2); - gpio_af_set(GPIOD, GPIO_AF_7, GPIO_PIN_8);//TX - gpio_af_set(GPIOD, GPIO_AF_7, GPIO_PIN_9);//RX - gpio_mode_set(GPIOD, GPIO_MODE_AF, GPIO_PUPD_NONE,GPIO_PIN_8); - gpio_output_options_set(GPIOD, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ,GPIO_PIN_8); - gpio_mode_set(GPIOD, GPIO_MODE_AF, GPIO_PUPD_NONE,GPIO_PIN_9); - gpio_output_options_set(GPIOD, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ,GPIO_PIN_9); - break; + // case UART_422://串口2,422 + // //使能端口时钟 + // rcu_periph_clock_enable(RCU_GPIOD); + // //使能串口时钟 + // rcu_periph_clock_enable(RCU_USART2); + // gpio_af_set(GPIOD, GPIO_AF_7, GPIO_PIN_8);//TX + // gpio_af_set(GPIOD, GPIO_AF_7, GPIO_PIN_9);//RX + // gpio_mode_set(GPIOD, GPIO_MODE_AF, GPIO_PUPD_NONE,GPIO_PIN_8); + // gpio_output_options_set(GPIOD, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ,GPIO_PIN_8); + // gpio_mode_set(GPIOD, GPIO_MODE_AF, GPIO_PUPD_NONE,GPIO_PIN_9); + // gpio_output_options_set(GPIOD, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ,GPIO_PIN_9); + // break; default: break; @@ -128,9 +128,9 @@ static void Usart_Nvic_config(uint32_t usart_periph) nvic_irq_enable(USART1_IRQn, 1, 2);//优先级配置为3,子优先及为1 break; - case UART_422://串口2,422 - nvic_irq_enable(USART2_IRQn, 1, 1);//优先级配置为3,子优先及为2 - break; + // case UART_422://串口2,422 + // nvic_irq_enable(USART2_IRQn, 1, 1);//优先级配置为3,子优先及为2 + // break; default: break; @@ -177,12 +177,12 @@ static void Uart_Init(void) BSP_IntVectSet(54,USART1_IRQHandler); BSP_IntEn(54); - ///422串口设备初始化 - usart_config(UART_422, g_ptz.uart_422_baud);//串口初始化 - Usart_Nvic_config(UART_422);//中断配置 - uart_422_handle = uart_init(UART_422, PTZ_UART_422_INDEX, ptz_uart_422_buff, sizeof(ptz_uart_422_buff)); - BSP_IntVectSet(55,USART2_IRQHandler); - BSP_IntEn(55); +// ///422串口设备初始化 +// usart_config(UART_422, g_ptz.uart_422_baud);//串口初始化 +// Usart_Nvic_config(UART_422);//中断配置 +// uart_422_handle = uart_init(UART_422, PTZ_UART_422_INDEX, ptz_uart_422_buff, sizeof(ptz_uart_422_buff)); +// BSP_IntVectSet(55,USART2_IRQHandler); +// BSP_IntEn(55); diff --git a/GD32F4xx_Firmware_Library/SYSTICK/gd32f4xx_it.c b/GD32F4xx_Firmware_Library/SYSTICK/gd32f4xx_it.c index 994f68c..5a3ed32 100644 --- a/GD32F4xx_Firmware_Library/SYSTICK/gd32f4xx_it.c +++ b/GD32F4xx_Firmware_Library/SYSTICK/gd32f4xx_it.c @@ -188,23 +188,23 @@ void USART1_IRQHandler(void) } -/*! - \brief USART2 中断处理函数 - \param[in] none - \param[out] none - \retval none - \note LH @2022.05.20 -*/ -void USART2_IRQHandler(void) -{ - u_int8_t c = 0; +// /*! +// \brief USART2 中断处理函数 +// \param[in] none +// \param[out] none +// \retval none +// \note LH @2022.05.20 +// */ +// void USART2_IRQHandler(void) +// { +// u_int8_t c = 0; - c = usart_data_receive(USART2);//读相应串口数据 +// c = usart_data_receive(USART2);//读相应串口数据 - IRQHandler_422_process(c); +// IRQHandler_422_process(c); - usart_interrupt_flag_clear(USART2 , USART_INT_FLAG_RBNE); -} +// usart_interrupt_flag_clear(USART2 , USART_INT_FLAG_RBNE); +// }