Skip to content

Commit cd6c0ea

Browse files
committed
zephyr: Correct usage of the UART flow control parameter.
Signed-off-by: Daniel Campora <[email protected]>
1 parent 7d5cb82 commit cd6c0ea

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ports/zephyr/machine_uart.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ static void mp_machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args,
9191
{ MP_QSTR_rxbuf, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = UART_TX_RING_BUF_DEF_SIZE} },
9292
{ MP_QSTR_timeout, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
9393
{ MP_QSTR_timeout_char, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
94-
{ MP_QSTR_flow, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
94+
{ MP_QSTR_flow, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
9595
};
9696

9797
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
@@ -136,9 +136,9 @@ static void mp_machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args,
136136
}
137137

138138
uint8_t flow_ctrl;
139-
if (args[ARG_flow].u_obj == mp_const_none) {
139+
if (args[ARG_flow].u_int == 0) {
140140
flow_ctrl = UART_CFG_FLOW_CTRL_NONE;
141-
} else if (mp_obj_get_int(args[ARG_flow].u_obj) == (MACHINE_UART_RTS | MACHINE_UART_RTS)) {
141+
} else if (args[ARG_flow].u_int == (MACHINE_UART_RTS | MACHINE_UART_CTS)) {
142142
flow_ctrl = UART_CFG_FLOW_CTRL_RTS_CTS;
143143
} else {
144144
mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("invalid flow control"));

0 commit comments

Comments
 (0)