GithubHelp home page GithubHelp logo

xpt2046-touchcontroller-py's Introduction

xpt2046-touchcontroller-py

A simple touch controller compatible with the fbcp-ili9341 display driver, designed for Raspberry Pi and tested with the 4.0inch SPI Module ST7796 and Raspberry Pi Zero W. This controller utilizes the auxiliary SPI wiring of the Raspberry Pi. You will need a touch screen with a xpt2046 chipset.

How to Use

  1. To also enable the auxiliary SPI device (three slave selects) add the line dtoverlay=spi1-3cs to /boot/config.txt.
  2. Ensure fbcp-ili9341 is set up and running with a compatible display.
  3. Modify the screen size in calibrate.py (line 14) to match your display: surfaceSize = (480, 320).
  4. Modify the screen size in demo.py (line 18) to match your display: surfaceSize = (480, 320).
  5. Run the calibration script: python3 calibrate.py
    • Press each circle for two seconds to register the location.
  6. Enjoy by running the demo script: python3 demo.py

Wiring

Connect the Raspberry Pi to the XPT2046 as follows:

Raspberry Pi XPT2046
SCLK_1 (GPIO21) CLK
CE_1 (GPIO17) CS
MOSI_1 (GPIO20) DIN
MISO_1 (GPIO19) DO
GPIO26 IRQ

Missing Features

  • A deadzone feature to exclude ghost touch at the border of the touchscreen.
  • Clean code improvements are welcome.

Contributions to improve the project are highly appreciated. Please feel free to contribute and improve.

xpt2046-touchcontroller-py's People

Contributors

georodin avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.