Skip to main content

A library to use XPT2046 touch module

Project description


Python library for XPT2046 Touchscreen. This library references Luca8991/XPT2046-Python and Adafruit_CircuitPython_RGB_Display.


Enable SPI for Raspberry Pi

sudo raspi-config nonint do_spi 0

No need to reboot.


Raspberri Pi <--> XPT2046
MOSI (GPIO10) <--> DIN
MISO (GPIO9) <--> DO
SCLK (GPIO11) <--> CLK
GPIO7 or any <--> CS
3V3 <--> VCC
GND <--> GND

This library does not use IRQ pin.

Code, same as in tests/ file:

from XPT2046_asukiaaa_python import XPT2046
import board
import busio
from digitalio import DigitalInOut
from time import sleep

cs = DigitalInOut(board.D7)
spi = busio.SPI(board.SCLK, board.MOSI, board.MISO)
touch = XPT2046(spi, cs=cs)

print("start monitoring touch")

while True:
    if touch.coordinate is not None:




Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

XPT2046-asukiaaa-python-1.0.0.tar.gz (4.0 kB view hashes)

Uploaded Source

Built Distribution

XPT2046_asukiaaa_python-1.0.0-py3-none-any.whl (4.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page