New MP user. I've seen how you can use IRQs with GPIO pins in Micropython. I've also been able to use
esp32.wake_on_touch to wake from light-sleep or deep-sleep using a touch pin. Unfortunately both these sleep modes disable GPIO pin power, and for my project I need LED power to stay on (and blinking via a timer). What I haven't been able to do is attach an interrupt callback to a touch pin. I tried:
Code: Select all
p=machine.Pin(33,machine.Pin.IN,machine.Pin.PULL_DOWN)
p.irq(handler=lambda p: print("Got Touch"),trigger=machine.Pin.IRQ_RISING)
t=machine.TouchPad(p)
t.config(400)
So how can you attach an interrupt handle with a threshold to a TouchPad enabled pin in micropython? Something equivalent to the Arduino
touchAttachInterrupt(pin, callback, threshold)? Alternatively, is there a touch-interruptible sleep mode that preserves power to the GPIO pins and running timers?