You've already forked Core2forAWS-MicroPython
mirror of
https://github.com/m5stack/Core2forAWS-MicroPython.git
synced 2026-05-20 10:30:31 -07:00
tests: Add test for pyb.disable_irq and pyb.enable_irq.
This commit is contained in:
@@ -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()
|
||||
@@ -0,0 +1,2 @@
|
||||
True
|
||||
True False
|
||||
Reference in New Issue
Block a user