Skip to content

Commit 0fc7158

Browse files
HubertXieGuozhanxin
authored andcommitted
[drivers]serial.c
解决STM32串口使用DMA接收方式时,清空缓存bug
1 parent 247d1a5 commit 0fc7158

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

components/drivers/serial/serial.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -955,9 +955,7 @@ static void _tc_flush(struct rt_serial_device *serial, int queue)
955955
{
956956
RT_ASSERT(RT_NULL != rx_fifo);
957957
level = rt_hw_interrupt_disable();
958-
rt_memset(rx_fifo->buffer, 0, serial->config.bufsz);
959-
rx_fifo->put_index = 0;
960-
rx_fifo->get_index = 0;
958+
rx_fifo->get_index = rx_fifo->put_index;
961959
rx_fifo->is_full = RT_FALSE;
962960
rt_hw_interrupt_enable(level);
963961
}

0 commit comments

Comments
 (0)