Page 1 of 1

Interrupt with TouchPad

Posted: Mon Dec 23, 2019 3:17 pm
by jdts
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?

Re: Interrupt with TouchPad

Posted: Sat Dec 28, 2019 10:53 pm
by jdts
Just an update, to see if anyone has any further info on this. I've learned from another MP port that the official implementation does not have interrupts on touch pins yet implemented, but that it should be straightforward. A reference simple example shows how "touch_pad_isr_register" can be used to do this. Since uPy supports wake-on-touch, it must already be using touch interrupts.

Re: Is it possible set an Interrupt for TouchPad

Posted: Tue Jun 01, 2021 4:57 pm
by kindmartin
any update here ?