Beispiel #1
0
def test_read_write():
    event = Event()

    event.write(0x6)
    assert event.size() == 1
    assert event.read(0x2) == 0x2
    assert event.read(0x4) == 0x4
Beispiel #2
0
def test_falling_edge():
    pin = Pin(board.PIN_D4, Pin.OUTPUT)
    pin.write(1)

    event = Event()

    exti = Exti(board.EXTI_D3, Exti.FALLING, event, 0x1)
    exti.start()

    # Make sure no interrupt has already occured.
    assert event.size() == 0

    # Trigger the interrupt and wait for the event.
    pin.write(0)

    if not 'Linux' in os.uname().machine:
        print("Waiting for the interrupt to occur... ")
        assert event.read(0x1) == 0x1

    exti.stop()
Beispiel #3
0
def test_falling_edge():
    pin = Pin(board.PIN_D4, Pin.OUTPUT)
    pin.write(1)

    event = Event()

    exti = Exti(board.EXTI_D3, Exti.FALLING, event, 0x1)
    exti.start()

    # Make sure no interrupt has already occured.
    assert event.size() == 0

    # Trigger the interrupt and wait for the event.
    pin.write(0)

    if not 'Linux' in os.uname().machine:
        print("Waiting for the interrupt to occur... ", end="")
        assert event.read(0x1) == 0x1
        print("ok.")

    exti.stop()