8000 stm32/machine_uart: Allow changing only the baudrate. · projectgus/micropython@c94a320 · GitHub
[go: up one dir, main page]

Skip to content

Commit c94a320

Browse files
committed
stm32/machine_uart: Allow changing only the baudrate.
Signed-off-by: Damien George <damien@micropython.org>
1 parent a5cc4d4 commit c94a320

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ports/stm32/machine_uart.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,12 @@ static void mp_machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args,
154154
{ MP_QSTR_read_buf_len, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 64} }, // legacy
155155
};
156156

157+
if (self->is_enabled && n_args == 1 && kw_args->used == 0) {
158+
// Only change the baudrate if that's all that is given.
159+
uart_set_baudrate(self, mp_obj_get_int(pos_args[0]));
160+
return;
161+
}
162+
157163
// parse args
158164
struct {
159165
mp_arg_val_t baudrate, bits, parity, stop, flow, timeout, timeout_char, rxbuf, read_buf_len;

0 commit comments

Comments
 (0)
0