drivers: uart: esp32: use config from device tree

The parity, stop bits and data bits config was hard-coded instead of
taken from the device tree.

Signed-off-by: Marco Widmer <marco.widmer@bytesatwork.ch>
This commit is contained in:
Marco Widmer 2023-11-23 17:46:44 +01:00 committed by Anas Nashif
commit 20979f80a6

View file

@ -999,9 +999,11 @@ static const DRAM_ATTR struct uart_driver_api uart_esp32_api = {
\
static struct uart_esp32_data uart_esp32_data_##idx = { \
.uart_config = {.baudrate = DT_INST_PROP(idx, current_speed), \
.parity = UART_CFG_PARITY_NONE, \
.stop_bits = UART_CFG_STOP_BITS_1, \
.data_bits = UART_CFG_DATA_BITS_8, \
.parity = DT_INST_ENUM_IDX_OR(idx, parity, UART_CFG_PARITY_NONE), \
.stop_bits = DT_INST_ENUM_IDX_OR(idx, stop_bits, \
UART_CFG_STOP_BITS_1), \
.data_bits = DT_INST_ENUM_IDX_OR(idx, data_bits, \
UART_CFG_DATA_BITS_8), \
.flow_ctrl = MAX(COND_CODE_1(DT_INST_PROP(idx, hw_rs485_hd_mode), \
(UART_CFG_FLOW_CTRL_RS485), \
(UART_CFG_FLOW_CTRL_NONE)), \