diff options
author | Damien George <damien.p.george@gmail.com> | 2014-08-25 18:44:10 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-08-25 18:44:10 +0100 |
commit | fa1a9bc9fd1683f1fb68739efc1aef303c8a1d2d (patch) | |
tree | 41493bf33d24c2a097889f46cec2f1badd771f8c /tests/pyb | |
parent | 34e43c7ee9700249dc6e5b333b7c264d45d6b530 (diff) | |
download | micropython-fa1a9bc9fd1683f1fb68739efc1aef303c8a1d2d.tar.gz micropython-fa1a9bc9fd1683f1fb68739efc1aef303c8a1d2d.zip |
tests: Add test for pyb.disable_irq and pyb.enable_irq.
Diffstat (limited to 'tests/pyb')
-rw-r--r-- | tests/pyb/irq.py | 22 | ||||
-rw-r--r-- | tests/pyb/irq.py.exp | 2 |
2 files changed, 24 insertions, 0 deletions
diff --git a/tests/pyb/irq.py b/tests/pyb/irq.py new file mode 100644 index 0000000000..42d276568e --- /dev/null +++ b/tests/pyb/irq.py @@ -0,0 +1,22 @@ +import pyb + +def test_irq(): + # test basic disable/enable + i1 = pyb.disable_irq() + print(i1) + pyb.enable_irq() # by default should enable IRQ + + # check that interrupts are enabled by waiting for ticks + pyb.delay(10) + + # check nested disable/enable + i1 = pyb.disable_irq() + i2 = pyb.disable_irq() + print(i1, i2) + pyb.enable_irq(i2) + pyb.enable_irq(i1) + + # check that interrupts are enabled by waiting for ticks + pyb.delay(10) + +test_irq() diff --git a/tests/pyb/irq.py.exp b/tests/pyb/irq.py.exp new file mode 100644 index 0000000000..aea065f045 --- /dev/null +++ b/tests/pyb/irq.py.exp @@ -0,0 +1,2 @@ +True +True False |