summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorarmink <[email protected]>2015-01-31 11:05:00 +0800
committerarmink <[email protected]>2015-01-31 11:05:00 +0800
commit1213dec3c972468fb65b3c3bcb9357c35797e227 (patch)
tree6c143856332c5ca399b5d57f03efa69ba2b85682
parentaaacd40425212ad2fab9bf31138f2e3a004b73e4 (diff)
fix #347
-rw-r--r--bsp/stm32f10x/drivers/usart.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/bsp/stm32f10x/drivers/usart.c b/bsp/stm32f10x/drivers/usart.c
index 4c6f24af30..b73f48519a 100644
--- a/bsp/stm32f10x/drivers/usart.c
+++ b/bsp/stm32f10x/drivers/usart.c
@@ -69,8 +69,6 @@ static rt_err_t stm32_configure(struct rt_serial_device *serial, struct serial_c
/* Enable USART */
USART_Cmd(uart->uart_device, ENABLE);
- /* enable interrupt */
- USART_ITConfig(uart->uart_device, USART_IT_RXNE, ENABLE);
return RT_EOK;
}
@@ -84,13 +82,19 @@ static rt_err_t stm32_control(struct rt_serial_device *serial, int cmd, void *ar
switch (cmd)
{
+ /* disable interrupt */
case RT_DEVICE_CTRL_CLR_INT:
/* disable rx irq */
UART_DISABLE_IRQ(uart->irq);
+ /* disable interrupt */
+ USART_ITConfig(uart->uart_device, USART_IT_RXNE, DISABLE);
break;
+ /* enable interrupt */
case RT_DEVICE_CTRL_SET_INT:
/* enable rx irq */
UART_ENABLE_IRQ(uart->irq);
+ /* enable interrupt */
+ USART_ITConfig(uart->uart_device, USART_IT_RXNE, ENABLE);
break;
}