drivers: uart: Add support for st single wire mode

An additional devicetree poperty `single-wire` is added
to uart and usart bindings of stm32. The driver checks this value
during initialization and enables the single wire mode when set.

Signed-off-by: Jonathan Hahn <Jonathan.Hahn@t-online.de>
This commit is contained in:
Jonathan Hahn 2022-01-01 23:41:19 +01:00 committed by Carles Cufí
commit 32f9dcf328
4 changed files with 26 additions and 0 deletions

View file

@ -1585,6 +1585,11 @@ static int uart_stm32_init(const struct device *dev)
/* Set the default baudrate */
uart_stm32_set_baudrate(dev, data->baud_rate);
/* Enable the single wire / half-duplex mode */
if (config->single_wire) {
LL_USART_EnableHalfDuplex(UartInstance);
}
LL_USART_Enable(UartInstance);
#ifdef USART_ISR_TEACK
@ -1701,6 +1706,7 @@ static const struct uart_stm32_config uart_stm32_cfg_##index = { \
.hw_flow_control = DT_INST_PROP(index, hw_flow_control), \
.parity = DT_INST_ENUM_IDX_OR(index, parity, UART_CFG_PARITY_NONE), \
.pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(index), \
.single_wire = DT_INST_PROP_OR(index, single_wire, false), \
STM32_UART_POLL_IRQ_HANDLER_FUNC(index) \
}; \
\