Skip to content

Commit 1213dec

Browse files
committed
fix #347
1 parent aaacd40 commit 1213dec

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

bsp/stm32f10x/drivers/usart.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ static rt_err_t stm32_configure(struct rt_serial_device *serial, struct serial_c
6969

7070
/* Enable USART */
7171
USART_Cmd(uart->uart_device, ENABLE);
72-
/* enable interrupt */
73-
USART_ITConfig(uart->uart_device, USART_IT_RXNE, ENABLE);
7472

7573
return RT_EOK;
7674
}
@@ -84,13 +82,19 @@ static rt_err_t stm32_control(struct rt_serial_device *serial, int cmd, void *ar
8482

8583
switch (cmd)
8684
{
85+
/* disable interrupt */
8786
case RT_DEVICE_CTRL_CLR_INT:
8887
/* disable rx irq */
8988
UART_DISABLE_IRQ(uart->irq);
89+
/* disable interrupt */
90+
USART_ITConfig(uart->uart_device, USART_IT_RXNE, DISABLE);
9091
break;
92+
/* enable interrupt */
9193
case RT_DEVICE_CTRL_SET_INT:
9294
/* enable rx irq */
9395
UART_ENABLE_IRQ(uart->irq);
96+
/* enable interrupt */
97+
USART_ITConfig(uart->uart_device, USART_IT_RXNE, ENABLE);
9498
break;
9599
}
96100

0 commit comments

Comments
 (0)