mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-25 22:34:19 +08:00
完善 Serial V2 框架 (#5770)
* [stm32] fix h7 uart V2 driver unused code. * [DeviceDriver][serialv2] fix the serialv2 when using for console device on DMA mode. * [stm32][art-pi] using serial v2 by default * [DeviceDriver][SerialV2] Add termios for serial@V2 . * [BSP][STM32] Add hardware flow control for STM32 serial@V2 driver. * [DeviceDriver][Serial@V2] Add hardware flow control for serial V2.
This commit is contained in:
@@ -119,7 +119,6 @@ static rt_err_t stm32_configure(struct rt_serial_device *serial, struct serial_c
|
||||
|
||||
uart->handle.Instance = uart->config->Instance;
|
||||
uart->handle.Init.BaudRate = cfg->baud_rate;
|
||||
uart->handle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
|
||||
uart->handle.Init.Mode = UART_MODE_TX_RX;
|
||||
uart->handle.Init.OverSampling = UART_OVERSAMPLING_16;
|
||||
|
||||
@@ -168,6 +167,19 @@ static rt_err_t stm32_configure(struct rt_serial_device *serial, struct serial_c
|
||||
break;
|
||||
}
|
||||
|
||||
switch (cfg->flowcontrol)
|
||||
{
|
||||
case RT_SERIAL_FLOWCONTROL_NONE:
|
||||
uart->handle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
|
||||
break;
|
||||
case RT_SERIAL_FLOWCONTROL_CTSRTS:
|
||||
uart->handle.Init.HwFlowCtl = UART_HWCONTROL_RTS_CTS;
|
||||
break;
|
||||
default:
|
||||
uart->handle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef RT_SERIAL_USING_DMA
|
||||
uart->dma_rx.remaining_cnt = serial->config.rx_bufsz;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user