MaixPy-v1_scripts
MaixPy-v1_scripts copied to clipboard
GPIO IRQ sample error
GPIO IRQ sample (https://github.com/sipeed/MaixPy_scripts/blob/master/hardware/demo_gpio_intr.py) has a wrong signature for the IRQ handler, at least for MaixPy 5
def test_irq(GPIO, pin_num):
print("key", pin_num)
Gives an error as callback is expected to have one argument only, the GPIO object. Replacing with:
def test_irq(gpio):
print("key", gpio)
works. However, GPIO module doesn't expose a reader for pin number so one has to compare gpio
against the gpio objects. Mabye not ideal in an IRQ handler?