xpt2046-circuitpython


Namexpt2046-circuitpython JSON
Version 1.0.3 PyPI version JSON
download
home_page
SummaryA simple XPT2046 chip reader designed for use with CircuitPython.
upload_time2024-01-28 20:35:36
maintainer
docs_urlNone
author
requires_python>=3.7
license
keywords xpt xpt2046 circuitpython spi pi tft
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## [skip to docs](https://github.com/humeman/xpt2046-circuitpython/blob/main/docs/README.md)

# xpt2046-circuitpython
A CircuitPython (or Adafruit-Blinka) library which reads values from an XPT2046 chip, commonly found on cheap microcontroller TFT displays.

## installation
This project is available on PyPi:
```sh
pip3 install xpt2046-circuitpython
```

Or, to install it manually:
```sh
git clone https://github.com/humeman/xpt2046-circuitpython
cd xpt2046-circuitpython
pip3 install .
```

If you're using this on regular Linux rather than CircuitPython, make sure you also [install Adafruit Blinka](https://learn.adafruit.com/circuitpython-on-raspberrypi-linux/installing-circuitpython-on-raspberry-pi).

## usage
Be sure to enable SPI in `sudo raspi-config` before proceeding.

### sample wiring

| TFT   | Board     | GPIO   | Pin # |
| ----- | --------- | ------ | ----- |
| T_CLK | SPI0 SCLK | GPIO11 | 23    |
| T_CS  |           | GPIO6  | 31    |
| T_DIN | SPI0 MOSI | GPIO10 | 19    |
| T_DO  | SPI0 MISO | GPIO9  | 21    |
| T_IRQ |           | GPIO22 | 15    |

### examples
The most basic read example is:
```py
import xpt2046_circuitpython
import time
import busio
import digitalio
from board import SCK, MOSI, MISO, D6, D22

# Pin config
T_CS_PIN = D6
T_IRQ_PIN = D22

# Set up SPI bus using hardware SPI
spi = busio.SPI(clock=SCK, MOSI=MOSI, MISO=MISO)
# Create touch controller
touch = xpt2046.Touch(
    spi, 
    cs = digitalio.DigitalInOut(T_CS_PIN),
    interrupt = digitalio.DigitalInOut(T_IRQ_PIN)
)

# Check if we have an interrupt signal
if touch.is_pressed():
    # Get the coordinates for this touch
    print(touch.get_coordinates())
```

Some more examples:
* [read.py](https://github.com/humeman/xpt2046-circuitpython/blob/main/samples/read.py): A simple program which continuously prints coordinates when the screen is pressed
* [adafruit-ili.py](https://github.com/humeman/xpt2046-circuitpython/blob/main/samples/adafruit-ili.py): A simple drawing program for an ILI9341 display controlled by the Adafruit display library

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "xpt2046-circuitpython",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "xpt,xpt2046,circuitpython,spi,pi,tft",
    "author": "",
    "author_email": "humeman <camden@humeman.com>",
    "download_url": "https://files.pythonhosted.org/packages/4b/72/b4865353ee8ab238d717053aa82d6d701d25d18b556f9d7669077e95d67d/xpt2046_circuitpython-1.0.3.tar.gz",
    "platform": null,
    "description": "## [skip to docs](https://github.com/humeman/xpt2046-circuitpython/blob/main/docs/README.md)\n\n# xpt2046-circuitpython\nA CircuitPython (or Adafruit-Blinka) library which reads values from an XPT2046 chip, commonly found on cheap microcontroller TFT displays.\n\n## installation\nThis project is available on PyPi:\n```sh\npip3 install xpt2046-circuitpython\n```\n\nOr, to install it manually:\n```sh\ngit clone https://github.com/humeman/xpt2046-circuitpython\ncd xpt2046-circuitpython\npip3 install .\n```\n\nIf you're using this on regular Linux rather than CircuitPython, make sure you also [install Adafruit Blinka](https://learn.adafruit.com/circuitpython-on-raspberrypi-linux/installing-circuitpython-on-raspberry-pi).\n\n## usage\nBe sure to enable SPI in `sudo raspi-config` before proceeding.\n\n### sample wiring\n\n| TFT   | Board     | GPIO   | Pin # |\n| ----- | --------- | ------ | ----- |\n| T_CLK | SPI0 SCLK | GPIO11 | 23    |\n| T_CS  |           | GPIO6  | 31    |\n| T_DIN | SPI0 MOSI | GPIO10 | 19    |\n| T_DO  | SPI0 MISO | GPIO9  | 21    |\n| T_IRQ |           | GPIO22 | 15    |\n\n### examples\nThe most basic read example is:\n```py\nimport xpt2046_circuitpython\nimport time\nimport busio\nimport digitalio\nfrom board import SCK, MOSI, MISO, D6, D22\n\n# Pin config\nT_CS_PIN = D6\nT_IRQ_PIN = D22\n\n# Set up SPI bus using hardware SPI\nspi = busio.SPI(clock=SCK, MOSI=MOSI, MISO=MISO)\n# Create touch controller\ntouch = xpt2046.Touch(\n    spi, \n    cs = digitalio.DigitalInOut(T_CS_PIN),\n    interrupt = digitalio.DigitalInOut(T_IRQ_PIN)\n)\n\n# Check if we have an interrupt signal\nif touch.is_pressed():\n    # Get the coordinates for this touch\n    print(touch.get_coordinates())\n```\n\nSome more examples:\n* [read.py](https://github.com/humeman/xpt2046-circuitpython/blob/main/samples/read.py): A simple program which continuously prints coordinates when the screen is pressed\n* [adafruit-ili.py](https://github.com/humeman/xpt2046-circuitpython/blob/main/samples/adafruit-ili.py): A simple drawing program for an ILI9341 display controlled by the Adafruit display library\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A simple XPT2046 chip reader designed for use with CircuitPython.",
    "version": "1.0.3",
    "project_urls": {
        "Bug Reports": "https://github.com/humeman/xpt2046-circuitpython/issues",
        "Docs": "https://github.com/humeman/xpt2046-circuitpython/blob/main/docs",
        "Homepage": "https://github.com/humeman/xpt2046-circuitpython",
        "Source": "https://github.com/humeman/xpt2046-circuitpython",
        "Teck Tips": "https://tecktip.today"
    },
    "split_keywords": [
        "xpt",
        "xpt2046",
        "circuitpython",
        "spi",
        "pi",
        "tft"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ee0db8b3f7c1b7210fb134cb5b41517dc064e7ddaba73a24ac1080726af18969",
                "md5": "7e3a4e244d5d821fb7b9bad0f7e770d7",
                "sha256": "0ba99b71809781503e437768679bdd1c41f99c8596ac42f22bea7495bea22da2"
            },
            "downloads": -1,
            "filename": "xpt2046_circuitpython-1.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7e3a4e244d5d821fb7b9bad0f7e770d7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 17840,
            "upload_time": "2024-01-28T20:35:31",
            "upload_time_iso_8601": "2024-01-28T20:35:31.919542Z",
            "url": "https://files.pythonhosted.org/packages/ee/0d/b8b3f7c1b7210fb134cb5b41517dc064e7ddaba73a24ac1080726af18969/xpt2046_circuitpython-1.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4b72b4865353ee8ab238d717053aa82d6d701d25d18b556f9d7669077e95d67d",
                "md5": "469786857721b81d087875a24d3ba7a1",
                "sha256": "5074fe5f2bb4612643facbf13343ffc16471bafa3a9f3bd83aea1268bfcb7f16"
            },
            "downloads": -1,
            "filename": "xpt2046_circuitpython-1.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "469786857721b81d087875a24d3ba7a1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 17400,
            "upload_time": "2024-01-28T20:35:36",
            "upload_time_iso_8601": "2024-01-28T20:35:36.213338Z",
            "url": "https://files.pythonhosted.org/packages/4b/72/b4865353ee8ab238d717053aa82d6d701d25d18b556f9d7669077e95d67d/xpt2046_circuitpython-1.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-28 20:35:36",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "humeman",
    "github_project": "xpt2046-circuitpython",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "xpt2046-circuitpython"
}
        
Elapsed time: 3.19904s