提交 71930b09 编写于 作者: B bernard

[BSP] Fix the interrupt issue in USART driver of STM32F4.

上级 950c3a42
...@@ -89,8 +89,6 @@ static rt_err_t stm32_configure(struct rt_serial_device *serial, struct serial_c ...@@ -89,8 +89,6 @@ static rt_err_t stm32_configure(struct rt_serial_device *serial, struct serial_c
/* Enable USART */ /* Enable USART */
USART_Cmd(uart->uart_device, ENABLE); USART_Cmd(uart->uart_device, ENABLE);
/* enable interrupt */
USART_ITConfig(uart->uart_device, USART_IT_RXNE, ENABLE);
return RT_EOK; return RT_EOK;
} }
...@@ -107,10 +105,14 @@ static rt_err_t stm32_control(struct rt_serial_device *serial, int cmd, void *ar ...@@ -107,10 +105,14 @@ static rt_err_t stm32_control(struct rt_serial_device *serial, int cmd, void *ar
case RT_DEVICE_CTRL_CLR_INT: case RT_DEVICE_CTRL_CLR_INT:
/* disable rx irq */ /* disable rx irq */
UART_DISABLE_IRQ(uart->irq); UART_DISABLE_IRQ(uart->irq);
/* disable interrupt */
USART_ITConfig(uart->uart_device, USART_IT_RXNE, DISABLE);
break; break;
case RT_DEVICE_CTRL_SET_INT: case RT_DEVICE_CTRL_SET_INT:
/* enable rx irq */ /* enable rx irq */
UART_ENABLE_IRQ(uart->irq); UART_ENABLE_IRQ(uart->irq);
/* enable interrupt */
USART_ITConfig(uart->uart_device, USART_IT_RXNE, ENABLE);
break; break;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册