diff options
author | Daniel Campora <daniel@wipy.io> | 2015-09-11 09:33:19 +0200 |
---|---|---|
committer | Daniel Campora <daniel@wipy.io> | 2015-09-16 10:10:13 +0200 |
commit | 7d6b6f66811b4424f9e353205b4416c4c64d772e (patch) | |
tree | 7e7cf947f769d2a94dddd5f21acd715b5493a61f /tests/wipy/uart.py | |
parent | 4ba9b340124e59ccc9d3daa3269132d9e4e6b7d3 (diff) |
cc3200: Make UART choose default id when not given.
Diffstat (limited to 'tests/wipy/uart.py')
-rw-r--r-- | tests/wipy/uart.py | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/tests/wipy/uart.py b/tests/wipy/uart.py index d6910eaa1..2c92de664 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() |