2014-08-25 13:44:10 -04:00
|
|
|
import pyb
|
|
|
|
|
2020-03-22 22:26:08 -04:00
|
|
|
|
2014-08-25 13:44:10 -04:00
|
|
|
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)
|
|
|
|
|
2020-03-22 22:26:08 -04:00
|
|
|
|
2014-08-25 13:44:10 -04:00
|
|
|
test_irq()
|