summaryrefslogtreecommitdiffstatshomepage
path: root/tests/ports/stm32/irq.py
blob: fd8742d3eaf7fae2a3351c796663034d27e0c4c0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import time
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
    time.sleep_ms(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
    time.sleep_ms(10)


test_irq()