跳转到主要内容

HyperPixel 2"圆型液晶显示屏的Python驱动程序

项目描述

HyperPixel 2"触摸圆型驱动程序

Build Status Coverage Status PyPi Package Python Versions

先决条件

您必须安装HyperPixel 2r驱动程序,该驱动程序为触摸IC启用i2c总线 - https://github.com/pimoroni/hyperpixel4/tree/hp2-round

安装

来自PyPi的稳定库

  • 只需运行pip3 install hyperpixel2r

在某些情况下,您可能需要使用sudo或使用以下方式安装pip:sudo apt install python3-pip

来自GitHub的最新/开发库

  • git clone https://github.com/pimoroni/hyperpixel2r-python
  • cd hyperpixel2r-python
  • sudo ./install.sh

使用方法

设置触摸驱动程序实例

touch = Touch(bus=11, i2c_addr=0x15, interrupt_pin=27):

触摸应通过装饰器@touch.on_touch来读取处理程序。

处理程序应接受参数touch_idxystate

  • touch_id - 0或1,具体取决于跟踪哪个触摸
  • x - 从0到479的x坐标
  • y - 从0到479的y坐标
  • state - 触摸状态,True为触摸,False为释放

例如

@touch.on_touch
def handle_touch(touch_id, x, y, state):
    print(touch_id, x, y, state)

变更日志

0.0.1

  • 初始发布

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。

源分发

hyperpixel2r-0.0.1.tar.gz (3.9 kB 查看哈希值)

上传时间 源代码

构建分发

hyperpixel2r-0.0.1-py3-none-any.whl (4.1 kB 查看哈希值)

上传时间 Python 3

hyperpixel2r-0.0.1-py2-none-any.whl (4.1 kB 查看哈希值)

上传时间 Python 2

支持者