You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
478 B
23 lines
478 B
10 years ago
|
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()
|