适用于广泛使用的日立HD44780控制器的树莓派LCD库。
项目描述
A Python 3/2 Raspberry PI Character LCD library for the Hitachi HD44780 controller. It supports both GPIO (parallel) mode as well as boards with an I²C port expander (e.g. the PCF8574 or the MCP23008).
This library is inspired by Adafruit Industries’ CharLCD library as well as by Arduino’s LiquidCrystal library.
For GPIO mode, no external dependencies (except the RPi.GPIO library, which comes preinstalled on Raspbian) are needed to use this library. If you want to control LCDs via I²C, then you also need the python-smbus or smbus2 library. If you want to control the LCD with pigpio, you have to install the pigpio library.
If you’re trying to get started with RPLCD, you should probably read the docs :)
设置
您可以直接通过PyPI使用pip安装RPLCD。
$ sudo pip install RPLCD
如果您想使用I²C,还需要smbus或smbus2库。
$ sudo apt install python-smbus or $ sudo pip install smbus2
RPLCD将首先尝试使用smbus(如果可用),如果不可用,将回退到smbus2。
您也可以不使用pip手动安装库。您可以选择将脚本复制到工作目录并导入它们,或者下载存储库并运行python setup.py install将其安装到Python包目录。
功能
已实现
简单易用的API
支持4位和8位模式
支持并行(GPIO)和I²C连接
支持自定义字符
支持背光控制电路
内置支持A00、A02(标准HD44780)或ST0B(见ST7066第11页)字符表
Python 2/3兼容
缓存:只有当字符发生变化时才写入
没有外部依赖(除RPi.GPIO外,如果需要I²C支持,还需要python-smbus或smbus2)
愿望列表
以下功能可能在未来的空闲时间和动力下实现
MicroPython端口
支持的I²C端口扩展器
PCF8574(阿里巴巴国际站上许多I²C LCD适配器使用)
MCP23008(用于Adafruit I²C LCD背板)
MCP23017
文档
稳定版(发布在PyPI上):http://rplcd.readthedocs.io/en/stable/
最新版(当前主分支):http://rplcd.readthedocs.io/en/latest/
测试
交互式测试脚本
要测试您的LCD,请运行带有testsuite目标的rplcd-tests脚本。
单元测试
还有单元测试。首先,安装依赖项
pip install -U -r requirements-dev.txt
然后运行测试
py.test -v
编码指南
PEP8通过flake8,设置max-line-width为99,忽略E126-E128,C901
flake8 --max-line-length=99 --ignore=E126,E127,E128,C901 RPLCD/lcd.py
关于HD44780
HD44780 LCD控制器是用于驱动字母数字LCD显示的控制器芯片。尽管它不再生产,但它有很多兼容的芯片/克隆,例如ST7066或KS0066。今天在名称中包含“HD44780”的显示器通常使用这些克隆之一构建,尽管它们大多数时候看起来都一样(如本README开头所示)。
资源
TC2004A-01数据表:http://www.adafruit.com/datasheets/TC2004A-01.pdf
HD44780U数据表:http://www.adafruit.com/datasheets/HD44780.pdf
ST7066数据表:https://www.sparkfun.com/datasheets/LCD/st7066.pdf
许可
项目详情
下载文件
下载您平台的文件。如果您不确定选择哪个,请了解有关 安装软件包 的更多信息。
源代码发行版
构建发行版
RPLCD-1.3.1.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | b99d293f358af1c0525fcfeabdc6466049e555db569ffbca3f217591fc14e4f9 |
|
MD5 | 40c5ceb170cdcfa36ebcb6263ea10c09 |
|
BLAKE2b-256 | 7ff79860cc59f12fcb80ced36b45ce05dd321f381b8ff3d00b79ad48bcbd96b9 |
RPLCD-1.3.1-py2.py3-none-any.whl 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 04920b645b4fea79addebbc9c8368971a5af307ca70df3f0b1842d3de2e01040 |
|
MD5 | be485fa6e5a4531aaa161ce33149ba83 |
|
BLAKE2b-256 | a933af205c7b6a1210af76957924070a6b0da909c8f1de755d5d321548274dde |