diff options
author | Damien George <damien@micropython.org> | 2024-10-20 23:12:47 +1100 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2024-10-22 11:50:05 +1100 |
commit | 7ed480fc6fa6f8d273ba5bcae7c575985684d665 (patch) | |
tree | ea03e60080f86c9de0b472d61d081ae527f10812 /tests/extmod/ssl_sslcontext_verify_mode.py | |
parent | 97af1001ae07c573bf432b9923dcdf78055a508c (diff) | |
download | micropython-7ed480fc6fa6f8d273ba5bcae7c575985684d665.tar.gz micropython-7ed480fc6fa6f8d273ba5bcae7c575985684d665.zip |
Revert "stm32/machine_uart: Allow changing only the baudrate."
This reverts commit c94a3205b044fb27fa703d5c280fb02a094f12e3.
The idea behind this reverted commit was that it allowed to reconfigure the
UART to change only the baudrate, which is important in the context of a
PPP connection where the baudrate may be changed as part of the protocol.
Also, other ports like the rp2 port have this behaviour, where individual
parameters of the UART can be changed with the `.init()` method.
But this commit was no good for a few reasons:
1. It's a subtle breaking change to the UART API, because existing code
that constructs or initialises a UART with just the baudrate would
expect all other parameters to be reset to their defaults. But with
this commit those parameters would remain unchanged.
2. Constructing a UART like `UART(1, 9600)` also hits this code path of
only changing the baudrate and does not reset other parameters, which is
unexpected.
3. It doesn't support setting the baudrate via keyword, eg
`UART.init(baudrate=9600)`.
4. The `timeout_char` field is not updated when changing only the baudrate,
which can lead to unexpected timeouts when reading/writing.
Due to point (4), this commit broke the `tests/ports/stm32/uart.py` test,
the `uart.writechar(1)` has a timeout because the `uart.init(2400)` does
not set the `timeout_char` for the new baudrate.
Points (2)-(4) could be fixed, but point (1) (being a breaking change)
would remain as an issue. So the commit is reverted.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'tests/extmod/ssl_sslcontext_verify_mode.py')
0 files changed, 0 insertions, 0 deletions