diff options
author | Damien George <damien.p.george@gmail.com> | 2015-11-30 17:29:52 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-11-30 17:29:52 +0000 |
commit | 0d9b450701d064efcf57b86c1b7fbe3931179959 (patch) | |
tree | 7ff5a19b9a3ca064d5d9b87af3bcfa1b83be61bd /tests/pyb/uart.py | |
parent | f99491cbf743d51fd2aa7332c0e03da64448d60a (diff) | |
download | micropython-0d9b450701d064efcf57b86c1b7fbe3931179959.tar.gz micropython-0d9b450701d064efcf57b86c1b7fbe3931179959.zip |
stmhal: Make uart.write() function correctly for timeout=0.
In non-blocking mode (timeout=0), uart.write() can now transmit all of its
data without raising an exception. uart.read() also works correctly in
this mode.
As part of this patch, timout_char now has a minimum value which is long
enough to transfer 1 character.
Addresses issue #1533.
Diffstat (limited to 'tests/pyb/uart.py')
-rw-r--r-- | tests/pyb/uart.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/pyb/uart.py b/tests/pyb/uart.py index cb0be91c0b..838dd9cfc6 100644 --- a/tests/pyb/uart.py +++ b/tests/pyb/uart.py @@ -23,3 +23,10 @@ print(uart.writechar(1)) # make sure this method exists uart.sendbreak() + +# non-blocking mode +uart = UART(1, 9600, timeout=0) +print(uart.write(b'1')) +print(uart.write(b'abcd')) +print(uart.writechar(1)) +print(uart.read(100)) |