用于EPD E-ink显示的CircuitPython库。
adafruit-circuitpython-epd的Python项目详细描述
用法示例
importdigitalioimportbusioimportboardfromadafruit_epd.epdimportAdafruit_EPDfromadafruit_epd.il0373importAdafruit_IL0373# create the spi device and pins we will needspi=busio.SPI(board.SCK,MOSI=board.MOSI,MISO=board.MISO)ecs=digitalio.DigitalInOut(board.D12)dc=digitalio.DigitalInOut(board.D11)srcs=digitalio.DigitalInOut(board.D10)# can be None to use internal memoryrst=digitalio.DigitalInOut(board.D9)# can be None to not use this pinbusy=digitalio.DigitalInOut(board.D5)# can be None to not use this pin# give them all to our driverprint("Creating display")display=Adafruit_IL0373(104,212,spi,# 2.13" Tri-color displaycs_pin=ecs,dc_pin=dc,sramcs_pin=srcs,rst_pin=rst,busy_pin=busy)display.rotation=1# clear the bufferprint("Clear buffer")display.fill(Adafruit_EPD.WHITE)display.pixel(10,100,Adafruit_EPD.BLACK)print("Draw Rectangles")display.fill_rect(5,5,10,10,Adafruit_EPD.RED)display.rect(0,0,20,30,Adafruit_EPD.BLACK)print("Draw lines")display.line(0,0,display.width-1,display.height-1,Adafruit_EPD.BLACK)display.line(0,display.height-1,display.width-1,0,Adafruit_EPD.RED)print("Draw text")display.text('hello world',25,10,Adafruit_EPD.BLACK)display.display()
贡献
欢迎投稿!请阅读我们的Code of Conduct 在帮助这个项目保持热情之前。
本地建筑
压缩发布文件
要在本地构建此库,您需要安装 circuitpython-build-tools包装。
python3 -m venv .env
source .env/bin/activate
pip install circuitpython-build-tools
安装后,请确保您处于虚拟环境中:
source .env/bin/activate
然后运行生成:
circuitpython-build-bundles --filename_prefix adafruit-circuitpython-epd --library_location .
斯芬克斯文件
sphinx用于根据代码中的rst文件和注释构建文档。第一, 安装依赖项(请随意重用上面的虚拟环境):
python3 -m venv .env
source .env/bin/activate
pip install Sphinx sphinx-rtd-theme
现在,激活虚拟环境后:
cd docs
sphinx-build -E -W -b html . _build/html
这将把文档输出到docs/_build/html。在浏览器中打开index.html以 查看它们。它还将(由于-w)错误的任何警告,像特拉维斯将。这是个很好的方法 本地验证它将通过。