use validator in mimx UART constructor

This commit is contained in:
Dan Halbert 2022-05-20 00:04:49 -04:00
parent a01dec1df9
commit 3c20b5f95f
1 changed files with 1 additions and 4 deletions

View File

@ -113,12 +113,9 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
bool sigint_enabled) {
self->baudrate = baudrate;
self->character_bits = bits;
self->character_bits = (uint8_t)mp_arg_validate_int_range(self->character_bits, 7, 8, MP_QSTR_bits);
self->timeout_ms = timeout * 1000;
if (self->character_bits != 7 && self->character_bits != 8) {
mp_arg_validate_int_range(self->character_bits, 7, 8, MP_QSTR_bits);
}
DBGPrintf(&mp_plat_print, "uart_construct: tx:%p rx:%p rts:%p cts:%p rs485:%p\n", tx, rx, rts, cts, rs485_dir);