diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wipy/uart.py | 23 | ||||
-rw-r--r-- | tests/wipy/uart.py.exp | 6 |
2 files changed, 27 insertions, 2 deletions
diff --git a/tests/wipy/uart.py b/tests/wipy/uart.py index d6910eaa1f..2c92de6649 100644 --- a/tests/wipy/uart.py +++ b/tests/wipy/uart.py @@ -24,11 +24,23 @@ pyb.repl_uart(None) for uart_id in uart_id_range: uart = UART(uart_id, 38400) print(uart) - uart.init(baudrate=57600, stop=1, parity=None, pins=uart_pins[uart_id][0]) + uart.init(57600, 8, None, 1, pins=uart_pins[uart_id][0]) uart.init(baudrate=9600, stop=2, parity=0, pins=uart_pins[uart_id][1]) - uart.init(baudrate=115200, parity=1, pins=uart_pins[uart_id][0]) + uart.init(baudrate=115200, parity=1, stop=1, pins=uart_pins[uart_id][0]) + uart = UART(baudrate=1000000) uart.sendbreak() +uart = UART() +print(uart) +uart = UART(baudrate=38400, pins=('GP12', 'GP13')) +print(uart) +uart = UART(pins=('GP12', 'GP13')) +print(uart) +uart = UART(pins=(None, 'GP17')) +print(uart) +uart = UART(baudrate=57600, pins=('GP16', 'GP17')) +print(uart) + # now it's time for some loopback tests between the uarts uart0 = UART(0, 1000000, pins=uart_pins[0][0]) print(uart0) @@ -50,6 +62,8 @@ print(buf) print(uart1.readinto(buf) == 2) print(buf) +# try initializing without the id +uart0 = UART(baudrate=1000000, pins=uart_pins[0][0]) uart0.write(b'1234567890') pyb.delay(2) # because of the fifo interrupt levels print(uart1.any() == 10) @@ -127,6 +141,11 @@ try: except Exception: print('Exception') +try: + UART(2, 9600) +except Exception: + print('Exception') + for uart_id in uart_id_range: uart = UART(uart_id, 1000000) uart.deinit() diff --git a/tests/wipy/uart.py.exp b/tests/wipy/uart.py.exp index 8e7da99f63..6f0ea80bec 100644 --- a/tests/wipy/uart.py.exp +++ b/tests/wipy/uart.py.exp @@ -1,5 +1,10 @@ UART(0, baudrate=38400, bits=8, parity=None, stop=1) UART(1, baudrate=38400, bits=8, parity=None, stop=1) +UART(0, baudrate=9600, bits=8, parity=None, stop=1) +UART(0, baudrate=38400, bits=8, parity=None, stop=1) +UART(0, baudrate=9600, bits=8, parity=None, stop=1) +UART(1, baudrate=9600, bits=8, parity=None, stop=1) +UART(1, baudrate=57600, bits=8, parity=None, stop=1) UART(0, baudrate=1000000, bits=8, parity=None, stop=1) UART(1, baudrate=1000000, bits=8, parity=None, stop=1) True @@ -40,6 +45,7 @@ Exception Exception Exception Exception +Exception UART(0) UART(0, baudrate=115200, bits=8, parity=None, stop=1) UART(1) |