Skip to content

Commit fa1a9bc

Browse files
committed
tests: Add test for pyb.disable_irq and pyb.enable_irq.
1 parent 34e43c7 commit fa1a9bc

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

tests/pyb/irq.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import pyb
2+
3+
def test_irq():
4+
# test basic disable/enable
5+
i1 = pyb.disable_irq()
6+
print(i1)
7+
pyb.enable_irq() # by default should enable IRQ
8+
9+
# check that interrupts are enabled by waiting for ticks
10+
pyb.delay(10)
11+
12+
# check nested disable/enable
13+
i1 = pyb.disable_irq()
14+
i2 = pyb.disable_irq()
15+
print(i1, i2)
16+
pyb.enable_irq(i2)
17+
pyb.enable_irq(i1)
18+
19+
# check that interrupts are enabled by waiting for ticks
20+
pyb.delay(10)
21+
22+
test_irq()

tests/pyb/irq.py.exp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
True
2+
True False

0 commit comments

Comments
 (0)