mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-02-07 20:14:34 +08:00
fix #347
This commit is contained in:
parent
aaacd40425
commit
1213dec3c9
@ -69,8 +69,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;
|
||||||
}
|
}
|
||||||
@ -84,13 +82,19 @@ static rt_err_t stm32_control(struct rt_serial_device *serial, int cmd, void *ar
|
|||||||
|
|
||||||
switch (cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
|
/* disable interrupt */
|
||||||
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;
|
||||||
|
/* enable interrupt */
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user