tests: Add test for pyb.disable_irq and pyb.enable_irq.

pull/828/head
Damien George 2014-08-25 18:44:10 +01:00
rodzic 34e43c7ee9
commit fa1a9bc9fd
2 zmienionych plików z 24 dodań i 0 usunięć

22
tests/pyb/irq.py 100644
Wyświetl plik

@ -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()

Wyświetl plik

@ -0,0 +1,2 @@
True
True False