Interrupt with TouchPad

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
jdts
Posts: 36
Joined: Mon Dec 23, 2019 2:55 pm

Interrupt with TouchPad

Post by jdts » Mon Dec 23, 2019 3:17 pm

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?

jdts
Posts: 36
Joined: Mon Dec 23, 2019 2:55 pm

Re: Interrupt with TouchPad

Post by jdts » Sat Dec 28, 2019 10:53 pm

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.

kindmartin
Posts: 20
Joined: Sun Apr 26, 2020 7:30 am

Re: Is it possible set an Interrupt for TouchPad

Post by kindmartin » Tue Jun 01, 2021 4:57 pm

any update here ?

Post Reply