Skip to content

Commit 12e9922

Browse files
matouch_esp32_s3_2_8_spi: boot button for back action
1 parent c4beb0b commit 12e9922

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

internal_filesystem/lib/mpos/board/matouch_esp32_s3_2_8.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,20 @@
8383
import mpos.indev.gt911 as gt911
8484
touch_dev = i2c.I2C.Device(bus=i2c_bus, dev_id=gt911.I2C_ADDR, reg_bits=gt911.BITS)
8585
indev = gt911.GT911(touch_dev, reset_pin=1, interrupt_pin=40, debug=True) # remove debug because it's slower
86+
from mpos import InputManager
87+
InputManager.register_indev(indev)
8688
except Exception as e:
8789
print(f"Touch init got exception: {e}")
8890

91+
# IO0 Button interrupt handler
92+
def io0_interrupt_handler(pin):
93+
print("IO0 button pressed!")
94+
from mpos import back_screen
95+
back_screen()
96+
97+
io0_pin = machine.Pin(0, machine.Pin.IN, machine.Pin.PULL_UP)
98+
io0_pin.irq(trigger=machine.Pin.IRQ_FALLING, handler=io0_interrupt_handler)
99+
89100
# Initialize LVGL
90101
lv.init()
91102

0 commit comments

Comments
 (0)