Skip to content

Commit

Permalink
drivers: uart: esp32: use config from device tree
Browse files Browse the repository at this point in the history
The parity, stop bits and data bits config was hard-coded instead of
taken from the device tree.

Signed-off-by: Marco Widmer <[email protected]>
  • Loading branch information
marcowidmer authored and nashif committed Nov 25, 2023
1 parent 0b39da6 commit 20979f8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/serial/uart_esp32.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)), \
Expand Down

0 comments on commit 20979f8

Please sign in to comment.