stm32/uart: Add ability to have a static built-in UART object.

A static UART is useful for internal peripherals that require a UART and
need to persist outside the soft-reset loop.
This commit is contained in:
Damien George
2018-12-10 13:08:31 +11:00
parent 61ef031687
commit dc23978dde
4 changed files with 9 additions and 6 deletions

View File

@@ -161,6 +161,11 @@ STATIC mp_obj_t pyb_uart_init_helper(pyb_uart_obj_t *self, size_t n_args, const
mp_arg_parse_all(n_args, pos_args, kw_args,
MP_ARRAY_SIZE(allowed_args), allowed_args, (mp_arg_val_t*)&args);
// static UARTs are used for internal purposes and shouldn't be reconfigured
if (self->is_static) {
mp_raise_ValueError("UART is static and can't be init'd");
}
// baudrate
uint32_t baudrate = args.baudrate.u_int;