diff options
| author | Damien George | 2018-12-10 13:02:11 +1100 |
|---|---|---|
| committer | Damien George | 2018-12-10 16:21:50 +1100 |
| commit | 61ef0316879aea9b7a3b6d0538a6143043fba0d2 (patch) | |
| tree | 693db3eccebb166e7db64238c128876bca920462 | |
| parent | 6ea45277bf73777fbbcc7e15bfffc6e14def8af6 (diff) | |
stm32/uart: Move config of char_width/char_mask to uart.c.
| -rw-r--r-- | ports/stm32/machine_uart.c | 11 | ||||
| -rw-r--r-- | ports/stm32/uart.c | 12 |
2 files changed, 12 insertions, 11 deletions
diff --git a/ports/stm32/machine_uart.c b/ports/stm32/machine_uart.c index dcaa842a0..f5f56c703 100644 --- a/ports/stm32/machine_uart.c +++ b/ports/stm32/machine_uart.c @@ -217,17 +217,6 @@ STATIC mp_obj_t pyb_uart_init_helper(pyb_uart_obj_t *self, size_t n_args, const // setup the read buffer m_del(byte, self->read_buf, self->read_buf_len << self->char_width); - if (bits == UART_WORDLENGTH_9B && parity == UART_PARITY_NONE) { - self->char_mask = 0x1ff; - self->char_width = CHAR_WIDTH_9BIT; - } else { - if (bits == UART_WORDLENGTH_9B || parity == UART_PARITY_NONE) { - self->char_mask = 0xff; - } else { - self->char_mask = 0x7f; - } - self->char_width = CHAR_WIDTH_8BIT; - } if (args.rxbuf.u_int >= 0) { // rxbuf overrides legacy read_buf_len args.read_buf_len.u_int = args.rxbuf.u_int; diff --git a/ports/stm32/uart.c b/ports/stm32/uart.c index 531cf5dfc..9d93bc1e5 100644 --- a/ports/stm32/uart.c +++ b/ports/stm32/uart.c @@ -318,6 +318,18 @@ bool uart_init(pyb_uart_obj_t *uart_obj, uart_obj->is_enabled = true; uart_obj->attached_to_repl = false; + if (bits == UART_WORDLENGTH_9B && parity == UART_PARITY_NONE) { + uart_obj->char_mask = 0x1ff; + uart_obj->char_width = CHAR_WIDTH_9BIT; + } else { + if (bits == UART_WORDLENGTH_9B || parity == UART_PARITY_NONE) { + uart_obj->char_mask = 0xff; + } else { + uart_obj->char_mask = 0x7f; + } + uart_obj->char_width = CHAR_WIDTH_8BIT; + } + return true; } |
