diff options
| author | Henrik Sölver <henrik.solver@gmail.com> | 2015-11-01 23:30:46 +0100 |
|---|---|---|
| committer | Damien George <damien.p.george@gmail.com> | 2015-11-02 23:09:49 +0000 |
| commit | 35e7d9c0f114ea078d0a19c7f9743fdc4c7e8a3b (patch) | |
| tree | 0a7f673a21d67945ffddc6786c19769bdf78298b /tests/pyb/can.py | |
| parent | 06f70973f7cbbb9b64d8fe3990a2addc5c3329fd (diff) | |
stmhal/can: Fix a bug in filter handling.
Reported here: http://forum.micropython.org/viewtopic.php?f=2&t=845
Diffstat (limited to 'tests/pyb/can.py')
| -rw-r--r-- | tests/pyb/can.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/pyb/can.py b/tests/pyb/can.py index 8c86349ea..cf8089a3b 100644 --- a/tests/pyb/can.py +++ b/tests/pyb/can.py @@ -58,6 +58,26 @@ else: else: print('failed, wrong data received') +# Test filters +for n in [0, 8, 16, 24]: + filter_id = 0b00001000 << n + filter_mask = 0b00011100 << n + id_ok = 0b00001010 << n + id_fail = 0b00011010 << n + + can.clearfilter(0) + can.setfilter(0, pyb.CAN.MASK32, 0, (filter_id, filter_mask)) + + can.send('ok', id_ok, timeout=3) + if can.any(0): + msg = can.recv(0) + print((hex(filter_id), hex(filter_mask), hex(msg[0]), msg[3])) + + can.send("fail", id_fail, timeout=3) + if can.any(0): + msg = can.recv(0) + print((hex(filter_id), hex(filter_mask), hex(msg[0]), msg[3])) + del can # Test RxCallbacks |
