Python driver for the HyperPixel 2" round LCD
Project description
HyperPixel 2" Round Touch Driver
Pre-requisites
You must install the HyperPixel 2r drivers which enable an i2c bus for the touch IC - https://github.com/pimoroni/hyperpixel4/tree/hp2-round
Installing
Stable library from PyPi:
- Just run
pip3 install hyperpixel2r
In some cases you may need to use sudo
or install pip with: sudo apt install python3-pip
Latest/development library from GitHub:
git clone https://github.com/pimoroni/hyperpixel2r-python
cd hyperpixel2r-python
sudo ./install.sh
Usage
Set up touch driver instance:
touch = Touch(bus=11, i2c_addr=0x15, interrupt_pin=27):
Touches should be read by decorating a handler with @touch.on_touch
.
The handler should accept the arguments touch_id
, x
, y
and state
.
touch_id
- 0 or 1 depending on which touch is trackedx
- x coordinate from 0 to 479y
- y coordinate from 0 to 479state
- touch stateTrue
for touched,False
for released
For example:
@touch.on_touch
def handle_touch(touch_id, x, y, state):
print(touch_id, x, y, state)
Changelog
0.0.1
- Initial Release
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
hyperpixel2r-0.0.1.tar.gz
(3.9 kB
view hashes)
Built Distributions
Close
Hashes for hyperpixel2r-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d49939f0b357c701c4c016ce49e17192596e2ee348cfc1bc37f32a9e5f418f2 |
|
MD5 | cd86449f53d5982d8e5a2ddc86000dba |
|
BLAKE2b-256 | 0be5717b07d02d24de95154b68b379f03e19c3b9d460c6c3a0fec493b41b555d |
Close
Hashes for hyperpixel2r-0.0.1-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1082d44957e6cac49359832f8680a548c8a4e3aaaa4d1ae48b9b6e9bab797242 |
|
MD5 | cffcdc43f017f37cf603c7555d2477ef |
|
BLAKE2b-256 | b2f1f4ee66c1091cf9d0fb7b4b3a69aab89a06ac292eb2e4fc23b3e3758fa9af |