summaryrefslogtreecommitdiffstatshomepage
path: root/tests
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-11-30 17:29:52 +0000
committerDamien George <damien.p.george@gmail.com>2015-11-30 17:29:52 +0000
commit0d9b450701d064efcf57b86c1b7fbe3931179959 (patch)
tree7ff5a19b9a3ca064d5d9b87af3bcfa1b83be61bd /tests
parentf99491cbf743d51fd2aa7332c0e03da64448d60a (diff)
downloadmicropython-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')
-rw-r--r--tests/pyb/uart.py7
-rw-r--r--tests/pyb/uart.py.exp8
2 files changed, 13 insertions, 2 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))
diff --git a/tests/pyb/uart.py.exp b/tests/pyb/uart.py.exp
index ea300c90cb..4be50d328a 100644
--- a/tests/pyb/uart.py.exp
+++ b/tests/pyb/uart.py.exp
@@ -12,9 +12,13 @@ UART XB
UART YA
UART YB
ValueError Z
-UART(1, baudrate=9600, bits=8, parity=None, stop=1, timeout=1000, timeout_char=0, read_buf_len=64)
-UART(1, baudrate=2400, bits=8, parity=None, stop=1, timeout=1000, timeout_char=0, read_buf_len=64)
+UART(1, baudrate=9600, bits=8, parity=None, stop=1, timeout=1000, timeout_char=2, read_buf_len=64)
+UART(1, baudrate=2400, bits=8, parity=None, stop=1, timeout=1000, timeout_char=6, read_buf_len=64)
0
3
4
None
+1
+4
+None
+None