跳转到主要内容

基于EK79686的电子纸显示屏的CircuitPython `displayio` 驱动器

项目描述

简介

Documentation Status Discord Build Status Code Style: Black

CircuitPython displayio 驱动器,用于基于EK79686的电子纸显示屏

依赖项

此驱动器依赖于

请确保所有依赖项都可在CircuitPython文件系统中使用。这可以通过下载Adafruit库和驱动器包或使用circup安装单个库轻松实现。

从PyPI安装

在支持GNU/Linux系统(如树莓派)上,您可以从PyPI本地安装驱动器。要为当前用户安装

pip3 install adafruit-circuitpython-ek79686

要全局安装(在某些情况下可能需要)

sudo pip3 install adafruit-circuitpython-ek79686

要在当前项目的虚拟环境中安装

mkdir project-name && cd project-name
python3 -m venv .venv
source .env/bin/activate
pip3 install adafruit-circuitpython-ek79686

使用Circup在连接的CircuitPython设备上安装

确保您已将circup安装到Python环境中。如果需要,请使用以下命令安装它

pip3 install circup

安装circup后,将您的CircuitPython设备连接到计算机,然后使用以下命令进行安装

circup install adafruit_ek79686

或以下命令更新现有版本

circup update

使用示例

import time
import board
import displayio
import adafruit_ek79686

# Used to ensure the display is free in CircuitPython
displayio.release_displays()

# Define the pins needed for display use on the Metro
spi = board.SPI()
epd_cs = board.D10
epd_dc = board.D9
epd_reset = board.D5
epd_busy = board.D6

# Create the displayio connection to the display pins
display_bus = displayio.FourWire(
    spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
)
time.sleep(1)  # Wait a bit

# Create the display object - the third color is red (0xff0000)
display = adafruit_ek79686.EK79686(
    display_bus,
    width=264,
    height=176,
    busy_pin=epd_busy,
    highlight_color=0xFF0000,
    rotation=90,
)

# Create a display group for our screen objects
g = displayio.Group()


# Display a ruler graphic from the root directory of the CIRCUITPY drive
with open("/display-ruler.bmp", "rb") as f:
    pic = displayio.OnDiskBitmap(f)
    # Create a Tilegrid with the bitmap and put in the displayio group
    # CircuitPython 6 & 7 compatible
    t = displayio.TileGrid(
        pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
    )
    # CircuitPython 7 compatible only
    # t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
    g.append(t)

    # Place the display group on the screen (does not refresh)
    display.show(g)

    # Show the image on the display
    display.refresh()

    print("refreshed")

    # Do Not refresh the screen more often than every 180 seconds
    #   for eInk displays! Rapid refreshes will damage the panel.
    time.sleep(180)

文档

该库的API文档可以在Read the Docs上找到。

有关构建库文档的信息,请参阅本指南

贡献

欢迎贡献!请在贡献之前阅读我们的行为准则,以帮助本项目保持友好。

项目详情


下载文件

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

源代码分发

adafruit-circuitpython-ek79686-1.1.0.tar.gz (32.7 kB 查看哈希值)

上传时间 源代码

构建分发

adafruit_circuitpython_ek79686-1.1.0-py3-none-any.whl (5.4 kB 查看哈希值)

上传时间 Python 3

支持者: