summaryrefslogtreecommitdiffstatshomepage
path: root/tests/pyb/halerror.py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-11-15 20:39:44 +0000
committerDamien George <damien.p.george@gmail.com>2014-11-15 20:39:44 +0000
commit224fee0e1080fa7cd654de240c32c8433bb07cf9 (patch)
treeacec380a63a2fe5bb6e8e33aa899749e39fba94f /tests/pyb/halerror.py
parentaec189a5ba4e1feac82625507851d4188f6dd510 (diff)
downloadmicropython-224fee0e1080fa7cd654de240c32c8433bb07cf9.tar.gz
micropython-224fee0e1080fa7cd654de240c32c8433bb07cf9.zip
stmhal: Fix HAL error raising; make test for it.
Addresses issue #968.
Diffstat (limited to 'tests/pyb/halerror.py')
-rw-r--r--tests/pyb/halerror.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/pyb/halerror.py b/tests/pyb/halerror.py
new file mode 100644
index 0000000000..1a6bce1a7e
--- /dev/null
+++ b/tests/pyb/halerror.py
@@ -0,0 +1,15 @@
+# test hal errors
+
+import pyb
+
+i2c = pyb.I2C(2, pyb.I2C.MASTER)
+try:
+ i2c.recv(1, 1)
+except OSError as e:
+ print(repr(e))
+
+can = pyb.CAN(1, pyb.CAN.NORMAL)
+try:
+ can.send('1', 1, timeout=50)
+except OSError as e:
+ print(repr(e))