diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/pyb/can.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/pyb/can.py b/tests/pyb/can.py index 923a83860f..f1cad860b9 100644 --- a/tests/pyb/can.py +++ b/tests/pyb/can.py @@ -1,5 +1,6 @@ from pyb import CAN +CAN.initfilterbanks(14) can = CAN(1) print(can) @@ -7,6 +8,9 @@ can.init(CAN.LOOPBACK) print(can) print(can.any(0)) +# Catch all filter +can.setfilter(0, CAN.MASK16, 0, (0, 0, 0, 0)) + can.send('abcd', 123) print(can.any(0)) print(can.recv(0)) @@ -17,7 +21,7 @@ print(can.recv(0)) can.send('abcd', 0x7FF + 1) print(can.recv(0)) -#Test too long message +# Test too long message try: can.send('abcdefghi', 0x7FF) except ValueError: @@ -27,14 +31,17 @@ else: del can -#Testing extended IDs +# Testing extended IDs can = CAN(1, CAN.LOOPBACK, extframe = True) +# Catch all filter +can.setfilter(0, CAN.MASK32, 0, (0, 0)) + print(can) try: can.send('abcde', 0x7FF + 1) except ValueError: - print('failed') + print('failed') else: r = can.recv(0) if r[0] == 0x7FF+1 and r[3] == b'abcde': |