Skip to content

Commit 3c20b5f

Browse files
committed
use validator in mimx UART constructor
1 parent a01dec1 commit 3c20b5f

File tree

1 file changed

+1
-4
lines changed
  • ports/mimxrt10xx/common-hal/busio

1 file changed

+1
-4
lines changed

ports/mimxrt10xx/common-hal/busio/UART.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,9 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
113113
bool sigint_enabled) {
114114

115115
self->baudrate = baudrate;
116-
self->character_bits = bits;
116+
self->character_bits = (uint8_t)mp_arg_validate_int_range(self->character_bits, 7, 8, MP_QSTR_bits);
117117
self->timeout_ms = timeout * 1000;
118118

119-
if (self->character_bits != 7 && self->character_bits != 8) {
120-
mp_arg_validate_int_range(self->character_bits, 7, 8, MP_QSTR_bits);
121-
}
122119

123120
DBGPrintf(&mp_plat_print, "uart_construct: tx:%p rx:%p rts:%p cts:%p rs485:%p\n", tx, rx, rts, cts, rs485_dir);
124121

0 commit comments

Comments
 (0)