Update drv_usart.c

This commit is contained in:
周传福 2019-05-22 14:53:49 +08:00 committed by GitHub
parent 1e10891f37
commit d548215a3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 11 deletions

View File

@ -731,17 +731,7 @@ static void stm32_dma_config(struct rt_serial_device *serial, rt_ubase_t flag)
CLEAR_BIT(uart->handle.Instance->CR3, USART_CR3_EIE); CLEAR_BIT(uart->handle.Instance->CR3, USART_CR3_EIE);
__HAL_UART_ENABLE_IT(&(uart->handle), UART_IT_IDLE); __HAL_UART_ENABLE_IT(&(uart->handle), UART_IT_IDLE);
} }
else if (flag == RT_DEVICE_FLAG_DMA_TX)
{
__HAL_UART_CLEAR_FLAG(&(uart->handle), UART_FLAG_TC);
while (__HAL_UART_GET_FLAG(&(uart->handle), UART_FLAG_TC) == RESET)
{
;
}
__HAL_UART_CLEAR_FLAG(&(uart->handle), UART_FLAG_TC);
__HAL_UART_ENABLE_IT(&(uart->handle), UART_IT_TC);
}
/* enable irq */ /* enable irq */
HAL_NVIC_SetPriority(dma_config->dma_irq, 0, 0); HAL_NVIC_SetPriority(dma_config->dma_irq, 0, 0);
HAL_NVIC_EnableIRQ(dma_config->dma_irq); HAL_NVIC_EnableIRQ(dma_config->dma_irq);