SSD1306 OLED显示器的CircuitPython库。
adafruit-circuitpython-ssd1306的Python项目详细描述
简介
用于SSD1306或SSD1305 OLED显示器的Adafruit CircuitPython驱动程序。注意,ssd1305显示器是向后兼容的,因此它们可以用相同的代码和命令代替ssd1306。
此驱动程序基于micropython源代码中的ssd1306驱动程序,但不同于 通过支持硬件I2C接口和Adafruit CircuitPythonAPI。为了一个 micropython机器api兼容库参见:https://github.com/adafruit/micropython-adafruit-ssd1306
用法示例
# Basic example of clearing and drawing pixels on a SSD1306 OLED display.# This example and library is meant to work with Adafruit CircuitPython API.# Author: Tony DiCola# License: Public Domain# Import all board pins.fromboardimportSCL,SDAimportbusio# Import the SSD1306 module.importadafruit_ssd1306# Create the I2C interface.i2c=busio.I2C(SCL,SDA)# Create the SSD1306 OLED class.# The first two parameters are the pixel width and pixel height. Change these# to the right size for your display!display=adafruit_ssd1306.SSD1306_I2C(128,32,i2c)# Alternatively you can change the I2C address of the device with an addr parameter:#display = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c, addr=0x31)# Clear the display. Always call show after changing pixels to make the display# update visible!display.fill(0)display.show()
贡献
欢迎投稿!请阅读我们的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-ssd1306 --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)错误的任何警告,像特拉维斯将。这是个很好的方法 本地验证它将通过。