aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDamien George2018-12-05 13:24:11 +1100
committerDamien George2018-12-05 13:24:11 +1100
commit8007d0bd16e1007453c7c801345458db5d663e21 (patch)
tree7d3c58244bb0bb74e3ea63fda7a80ee424c416c5 /tests
parentc6365ffb922c7718b0ab238fe2437d4b726228b7 (diff)
stm32/uart: Add rxbuf keyword arg to UART constructor and init method.
As per the machine.UART documentation, this is used to set the length of the RX buffer. The legacy read_buf_len argument is retained for backwards compatibility, with rxbuf overriding it if provided.
Diffstat (limited to 'tests')
-rw-r--r--tests/pyb/uart.py12
-rw-r--r--tests/pyb/uart.py.exp8
2 files changed, 18 insertions, 2 deletions
diff --git a/tests/pyb/uart.py b/tests/pyb/uart.py
index 838dd9cfc..836b073a6 100644
--- a/tests/pyb/uart.py
+++ b/tests/pyb/uart.py
@@ -30,3 +30,15 @@ print(uart.write(b'1'))
print(uart.write(b'abcd'))
print(uart.writechar(1))
print(uart.read(100))
+
+# set rxbuf
+uart.init(9600, rxbuf=8)
+print(uart)
+uart.init(9600, rxbuf=0)
+print(uart)
+
+# set read_buf_len (legacy, use rxbuf instead)
+uart.init(9600, read_buf_len=4)
+print(uart)
+uart.init(9600, read_buf_len=0)
+print(uart)
diff --git a/tests/pyb/uart.py.exp b/tests/pyb/uart.py.exp
index 434cdfeeb..f3e6bbe28 100644
--- a/tests/pyb/uart.py.exp
+++ b/tests/pyb/uart.py.exp
@@ -12,8 +12,8 @@ UART XB
UART YA
UART YB
ValueError Z
-UART(1, baudrate=9600, bits=8, parity=None, stop=1, flow=0, timeout=1000, timeout_char=3, read_buf_len=64)
-UART(1, baudrate=2400, bits=8, parity=None, stop=1, flow=0, timeout=1000, timeout_char=7, read_buf_len=64)
+UART(1, baudrate=9600, bits=8, parity=None, stop=1, flow=0, timeout=1000, timeout_char=3, rxbuf=64)
+UART(1, baudrate=2400, bits=8, parity=None, stop=1, flow=0, timeout=1000, timeout_char=7, rxbuf=64)
0
3
4
@@ -22,3 +22,7 @@ None
4
None
None
+UART(1, baudrate=9600, bits=8, parity=None, stop=1, flow=0, timeout=1000, timeout_char=3, rxbuf=8)
+UART(1, baudrate=9600, bits=8, parity=None, stop=1, flow=0, timeout=1000, timeout_char=3, rxbuf=0)
+UART(1, baudrate=9600, bits=8, parity=None, stop=1, flow=0, timeout=1000, timeout_char=3, rxbuf=4)
+UART(1, baudrate=9600, bits=8, parity=None, stop=1, flow=0, timeout=1000, timeout_char=3, rxbuf=0)