Compare commits

...

58 commits
patch ... main

Author SHA1 Message Date
Dan Halbert
4ebf9c2854
Merge pull request #15 from FoamyGuy/odb_api_update
use new OnDiskBitmap API
2025-06-27 15:47:07 -04:00
foamyguy
95ad8510a8 use new OnDiskBitmap API 2025-06-27 13:01:24 -05:00
foamyguy
776b932ebf update rtd.yml file
Signed-off-by: foamyguy <foamyguy@gmail.com>
2025-06-17 10:24:51 -05:00
Scott Shawcroft
372032b65e
Merge pull request #14 from FoamyGuy/use_ruff_remove_8x_compat
use ruff and remove 8x displayio code
2025-02-25 09:21:20 -08:00
foamyguy
b62eabca9b use ruff and remove 8x displayio code 2025-02-24 15:57:16 -06:00
foamyguy
77c56d659b add sphinx configuration to rtd.yaml
Signed-off-by: foamyguy <foamyguy@gmail.com>
2025-01-16 09:12:22 -06:00
foamyguy
5c179803c2 remove deprecated get_html_theme_path() call
Signed-off-by: foamyguy <foamyguy@gmail.com>
2024-10-07 14:46:04 -05:00
Alec Delaney
a74fbafaec
Merge pull request #13 from FoamyGuy/fix_readme
fix circup instruction
2024-02-26 12:45:00 -05:00
foamyguy
29f679f7be fix circup instruction 2024-02-26 11:35:57 -06:00
foamyguy
b9c8eedd7b
Merge pull request #12 from dhalbert/fourwire
support 8.x.x. and 9.x.x FourWire
2023-12-18 14:17:49 -06:00
Dan Halbert
de0d006484 support 8.x.x. and 9.x.x FourWire 2023-12-18 11:44:59 -05:00
foamyguy
3203fbaea4 unpin sphinx and add sphinx-rtd-theme to docs reqs
Signed-off-by: foamyguy <foamyguy@gmail.com>
2023-12-04 09:55:35 -06:00
Dan Halbert
ddd258fbd8
Merge pull request #11 from prcutler/main
Update with root_group and fourwire for CP 9 compatibility
2023-11-03 08:54:28 -04:00
Paul Cutler
01c783d1a2 Update with root_group and fourwire for CP 9 compatibility 2023-11-02 14:19:16 -05:00
foamyguy
40348f2e78 "fix rtd theme
"
2023-09-18 16:18:40 -05:00
Tekktrik
b9a599ae27 Update .pylintrc, fix jQuery for docs
Signed-off-by: Tekktrik <tekktrik@gmail.com>
2023-05-23 21:16:34 -04:00
Tekktrik
5563fb3576 Run pre-commit 2023-05-10 22:47:16 -04:00
Tekktrik
2b420351ba Update pre-commit hooks
Signed-off-by: Tekktrik <tekktrik@gmail.com>
2023-05-10 15:22:28 -04:00
Alec Delaney
d438161c7d Add upload url to release action
Signed-off-by: Alec Delaney <89490472+tekktrik@users.noreply.github.com>
2023-01-19 23:51:03 -05:00
Alec Delaney
3120b74159 Add .venv to .gitignore
Signed-off-by: Alec Delaney <89490472+tekktrik@users.noreply.github.com>
2022-11-30 19:39:54 -05:00
Melissa LeBlanc-Williams
b6d9f852f5
Merge pull request #8 from makermelissa/main
Added tri-color support
2022-11-18 14:23:18 -08:00
Melissa LeBlanc-Williams
e7fc529bdf Added tri-color support 2022-11-18 13:16:21 -08:00
Alec Delaney
a64fad692c Update .pylintrc for v2.15.5 2022-11-04 18:34:33 -04:00
Alec Delaney
6cf029586e Fix release CI files 2022-11-04 09:12:45 -04:00
Alec Delaney
42e4918fa2 Update pylint to 2.15.5 2022-11-04 08:15:20 -04:00
Alec Delaney
6cac813f05 Updated pylint version to 2.13.0 2022-11-04 00:47:00 -04:00
Alec Delaney
5b2331c9ab Switching to composite actions 2022-11-04 00:02:50 -04:00
Alec Delaney
565fed5151
Merge pull request #7 from tcfranks/main
Add Missing Type Annotations
2022-09-02 15:38:38 -04:00
Thomas Franks
8b59a82478 Add Missing Type Annotations 2022-09-02 13:37:44 -04:00
Alec Delaney
5a92eceeae Use year duration range for copyright attribution 2022-08-23 17:26:21 -04:00
Alec Delaney
4480b8633e Keep copyright up to date in documentation 2022-08-22 21:36:32 -04:00
Alec Delaney
bdda976bb0 Fix version strings in workflow files 2022-08-16 21:09:14 -04:00
Alec Delaney
77c8554edc Update version string 2022-08-16 18:09:14 -04:00
Alec Delaney
9d6bfff5b7 Add setuptools-scm to build system requirements
Signed-off-by: Alec Delaney <tekktrik@gmail.com>
2022-08-09 13:41:03 -04:00
Alec Delaney
d35d1ded45 Switched to pyproject.toml 2022-08-08 22:05:54 -04:00
evaherrada
73742f402f
Changed .env to .venv in README.rst 2022-07-22 13:59:29 -04:00
evaherrada
b7985dec00
Added cp.org link to index.rst 2022-06-07 15:35:09 -04:00
Alec Delaney
c48d549e20 Set language to "en" for documentation
Signed-off-by: Alec Delaney <tekktrik@gmail.com>
2022-05-30 17:41:09 -04:00
Alec Delaney
5e3a9c04c4 Increase min lines similarity
Signed-off-by: Alec Delaney <tekktrik@gmail.com>
2022-05-25 19:31:29 -04:00
Limor "Ladyada" Fried
3f3f7bd6e2
Merge pull request #4 from HDR/main
Implement grayscale support
2022-05-21 22:19:50 -04:00
Martin Refseth
42c745b3b6 Add Copyrighttext and license identifier 2022-05-21 18:05:12 +02:00
Martin Refseth
8de8522776 Add example for grayscale displays 2022-05-21 17:56:34 +02:00
Martin Refseth
6c30c9b4cd Update adafruit_uc8151d.py 2022-05-20 20:04:38 +02:00
Martin Refseth
f662c7a356 Update adafruit_uc8151d.py 2022-05-20 19:49:24 +02:00
Martin Refseth
282643cf3b Remove print used for debugging 2022-05-19 22:04:56 +02:00
Martin Refseth
53bbdd8e34 Implement grayscale support 2022-05-19 21:45:02 +02:00
Alec Delaney
bb11cd43bf Patch .pre-commit-config.yaml 2022-05-15 12:20:30 -04:00
foamyguy
4f8492eaae change discord badge 2022-04-24 14:00:09 -05:00
evaherrada
e6aaa45f82
Patch: Replaced discord badge image 2022-04-22 15:59:31 -04:00
evaherrada
da40f49cbe
Updated gitignore
Signed-off-by: evaherrada <eva.herrada@adafruit.com>
2022-04-21 16:54:17 -04:00
Kattni Rembor
d099b5a7f8 Update Black to latest.
Signed-off-by: Kattni Rembor <kattni@adafruit.com>
2022-03-28 18:09:22 -04:00
dherrada
e5fad09b19 Fixed readthedocs build
Signed-off-by: dherrada <dylan.herrada@adafruit.com>
2022-02-15 11:54:34 -05:00
tekktrik
1d3e4c66d9
Post-patch cleanup
Manual fix for consolidating Documentation sections of README
2022-02-10 09:33:59 -05:00
Alec Delaney
3888085f62 Consolidate Documentation sections of README 2022-02-10 09:29:52 -05:00
dherrada
9b60b81678 Updated docs link, updated python docs link, updated setup.py 2022-01-24 16:46:17 -05:00
dherrada
ff54b20f1d First part of patch
Signed-off-by: dherrada <dylan.herrada@adafruit.com>
2022-01-19 13:51:12 -05:00
foamyguy
e8ebe833aa update rtd py version 2021-11-23 13:10:26 -06:00
Kattni
5504e52068
Merge pull request #3 from adafruit/patch
Pylint and RTD update patch, and other fixes
2021-11-11 16:28:09 -05:00
25 changed files with 560 additions and 788 deletions

11
.gitattributes vendored Normal file
View file

@ -0,0 +1,11 @@
# SPDX-FileCopyrightText: 2024 Justin Myers for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
.py text eol=lf
.rst text eol=lf
.txt text eol=lf
.yaml text eol=lf
.toml text eol=lf
.license text eol=lf
.md text eol=lf

View file

@ -4,7 +4,7 @@
Thank you for contributing! Before you submit a pull request, please read the following.
Make sure any changes you're submitting are in line with the CircuitPython Design Guide, available here: https://circuitpython.readthedocs.io/en/latest/docs/design_guide.html
Make sure any changes you're submitting are in line with the CircuitPython Design Guide, available here: https://docs.circuitpython.org/en/latest/docs/design_guide.html
If your changes are to documentation, please verify that the documentation builds locally by following the steps found here: https://adafru.it/build-docs

View file

@ -10,73 +10,5 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Translate Repo Name For Build Tools filename_prefix
id: repo-name
run: |
echo ::set-output name=repo-name::$(
echo ${{ github.repository }} |
awk -F '\/' '{ print tolower($2) }' |
tr '_' '-'
)
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Versions
run: |
python3 --version
- name: Checkout Current Repo
uses: actions/checkout@v1
with:
submodules: true
- name: Checkout tools repo
uses: actions/checkout@v2
with:
repository: adafruit/actions-ci-circuitpython-libs
path: actions-ci
- name: Install dependencies
# (e.g. - apt-get: gettext, etc; pip: circuitpython-build-tools, requirements.txt; etc.)
run: |
source actions-ci/install.sh
- name: Pip install Sphinx, pre-commit
run: |
pip install --force-reinstall Sphinx sphinx-rtd-theme pre-commit
- name: Library version
run: git describe --dirty --always --tags
- name: Setup problem matchers
uses: adafruit/circuitpython-action-library-ci-problem-matchers@v1
- name: Pre-commit hooks
run: |
pre-commit run --all-files
- name: Build assets
run: circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --library_location .
- name: Archive bundles
uses: actions/upload-artifact@v2
with:
name: bundles
path: ${{ github.workspace }}/bundles/
- name: Check For docs folder
id: need-docs
run: |
echo ::set-output name=docs::$( find . -wholename './docs' )
- name: Build docs
if: contains(steps.need-docs.outputs.docs, 'docs')
working-directory: docs
run: sphinx-build -E -W -b html . _build/html
- name: Check For setup.py
id: need-pypi
run: |
echo ::set-output name=setup-py::$( find . -wholename './setup.py' )
- name: Build Python package
if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
run: |
pip install --upgrade setuptools wheel twine readme_renderer testresources
python setup.py sdist
python setup.py bdist_wheel --universal
twine check dist/*
- name: Setup problem matchers
uses: adafruit/circuitpython-action-library-ci-problem-matchers@v1
- name: Run Build CI workflow
uses: adafruit/workflows-circuitpython-libs/build@main

View file

@ -1,99 +0,0 @@
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
#
# SPDX-License-Identifier: MIT
name: Release Actions
on:
release:
types: [published]
jobs:
upload-release-assets:
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Translate Repo Name For Build Tools filename_prefix
id: repo-name
run: |
echo ::set-output name=repo-name::$(
echo ${{ github.repository }} |
awk -F '\/' '{ print tolower($2) }' |
tr '_' '-'
)
- name: Set up Python 3.6
uses: actions/setup-python@v1
with:
python-version: 3.6
- name: Versions
run: |
python3 --version
- name: Checkout Current Repo
uses: actions/checkout@v1
with:
submodules: true
- name: Checkout tools repo
uses: actions/checkout@v2
with:
repository: adafruit/actions-ci-circuitpython-libs
path: actions-ci
- name: Install deps
run: |
source actions-ci/install.sh
- name: Build assets
run: circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --library_location .
- name: Upload Release Assets
# the 'official' actions version does not yet support dynamically
# supplying asset names to upload. @csexton's version chosen based on
# discussion in the issue below, as its the simplest to implement and
# allows for selecting files with a pattern.
# https://github.com/actions/upload-release-asset/issues/4
#uses: actions/upload-release-asset@v1.0.1
uses: csexton/release-asset-action@master
with:
pattern: "bundles/*"
github-token: ${{ secrets.GITHUB_TOKEN }}
upload-pypi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Check For setup.py
id: need-pypi
run: |
echo ::set-output name=setup-py::$( find . -wholename './setup.py' )
- name: Set up Python
if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Install dependencies
if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
env:
TWINE_USERNAME: ${{ secrets.pypi_username }}
TWINE_PASSWORD: ${{ secrets.pypi_password }}
run: |
python setup.py sdist
# After the dist file is packaged, extract it, update the __version__
# lines and repackage it.
cd dist
ZIP_FILE=`ls | sed -e "s/\.tar\.gz$//"`
echo "ZIP FILE = ${ZIP_FILE}"
tar xzf "${ZIP_FILE}.tar.gz"
echo The latest release version is \"${{github.event.release.tag_name}}\".
# Don't descend into ./.env, ./.eggs, or ./docs
for file in $(find -not -path "./.*" -not -path "./docs*" -name "*.py"); do
sed -i -e "s/0.0.0-auto.0/${{github.event.release.tag_name}}/" $file;
done;
tar czf "${ZIP_FILE}.tar.gz" "${ZIP_FILE}"
rm -rf "${ZIP_FILE}"
cd ..
twine upload dist/*

19
.github/workflows/release_gh.yml vendored Normal file
View file

@ -0,0 +1,19 @@
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
#
# SPDX-License-Identifier: MIT
name: GitHub Release Actions
on:
release:
types: [published]
jobs:
upload-release-assets:
runs-on: ubuntu-latest
steps:
- name: Run GitHub Release CI workflow
uses: adafruit/workflows-circuitpython-libs/release-gh@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
upload-url: ${{ github.event.release.upload_url }}

19
.github/workflows/release_pypi.yml vendored Normal file
View file

@ -0,0 +1,19 @@
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
#
# SPDX-License-Identifier: MIT
name: PyPI Release Actions
on:
release:
types: [published]
jobs:
upload-release-assets:
runs-on: ubuntu-latest
steps:
- name: Run PyPI Release CI workflow
uses: adafruit/workflows-circuitpython-libs/release-pypi@main
with:
pypi-username: ${{ secrets.pypi_username }}
pypi-password: ${{ secrets.pypi_password }}

50
.gitignore vendored
View file

@ -1,18 +1,48 @@
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
# SPDX-FileCopyrightText: 2022 Kattni Rembor, written for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
# SPDX-License-Identifier: MIT
# Do not include files and directories created by your personal work environment, such as the IDE
# you use, except for those already listed here. Pull requests including changes to this file will
# not be accepted.
# This .gitignore file contains rules for files generated by working with CircuitPython libraries,
# including building Sphinx, testing with pip, and creating a virual environment, as well as the
# MacOS and IDE-specific files generated by using MacOS in general, or the PyCharm or VSCode IDEs.
# If you find that there are files being generated on your machine that should not be included in
# your git commit, you should create a .gitignore_global file on your computer to include the
# files created by your personal setup. To do so, follow the two steps below.
# First, create a file called .gitignore_global somewhere convenient for you, and add rules for
# the files you want to exclude from git commits.
# Second, configure Git to use the exclude file for all Git repositories by running the
# following via commandline, replacing "path/to/your/" with the actual path to your newly created
# .gitignore_global file:
# git config --global core.excludesfile path/to/your/.gitignore_global
# CircuitPython-specific files
*.mpy
.idea
# Python-specific files
__pycache__
_build
*.pyc
# Sphinx build-specific files
_build
# This file results from running `pip -e install .` in a local repository
*.egg-info
# Virtual environment-specific files
.env
.python-version
build*/
bundles
.venv
# MacOS-specific files
*.DS_Store
.eggs
dist
**/*.egg-info
# IDE-specific files
.idea
.vscode
*~

View file

@ -1,42 +1,21 @@
# SPDX-FileCopyrightText: 2020 Diego Elio Pettenò
# SPDX-FileCopyrightText: 2024 Justin Myers for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
repos:
- repo: https://github.com/python/black
rev: 20.8b1
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: black
- repo: https://github.com/fsfe/reuse-tool
rev: v0.12.1
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.4
hooks:
- id: reuse
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
- id: ruff-format
- id: ruff
args: ["--fix"]
- repo: https://github.com/fsfe/reuse-tool
rev: v3.0.1
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/pycqa/pylint
rev: v2.11.1
hooks:
- id: pylint
name: pylint (library code)
types: [python]
args:
- --disable=consider-using-f-string
exclude: "^(docs/|examples/|tests/|setup.py$)"
- id: pylint
name: pylint (example code)
description: Run pylint rules on "examples/*.py" files
types: [python]
files: "^examples/"
args:
- --disable=missing-docstring,invalid-name,consider-using-f-string,duplicate-code
- id: pylint
name: pylint (test code)
description: Run pylint rules on "tests/*.py" files
types: [python]
files: "^tests/"
args:
- --disable=missing-docstring,consider-using-f-string,duplicate-code
- id: reuse

436
.pylintrc
View file

@ -1,436 +0,0 @@
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
[MASTER]
# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code
extension-pkg-whitelist=
# Add files or directories to the ignore-list. They should be base names, not
# paths.
ignore=CVS
# Add files or directories matching the regex patterns to the ignore-list. The
# regex matches against base names, not paths.
ignore-patterns=
# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
#init-hook=
# Use multiple processes to speed up Pylint.
jobs=1
# List of plugins (as comma separated values of python modules names) to load,
# usually to register additional checkers.
load-plugins=
# Pickle collected data for later comparisons.
persistent=yes
# Specify a configuration file.
#rcfile=
# Allow loading of arbitrary C extensions. Extensions are imported into the
# active Python interpreter and may run arbitrary code.
unsafe-load-any-extension=no
[MESSAGES CONTROL]
# Only show warnings with the listed confidence levels. Leave empty to show
# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED
confidence=
# Disable the message, report, category or checker with the given id(s). You
# can either give multiple identifiers separated by comma (,) or put this
# option multiple times (only on the command line, not in the configuration
# file where it should appear only once).You can also use "--disable=all" to
# disable everything first and then reenable specific checks. For example, if
# you want to run only the similarities checker, you can use "--disable=all
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
# disable=import-error,print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call
disable=print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call,import-error,bad-continuation,pointless-string-statement,unspecified-encoding
# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
# multiple time (only on the command line, not in the configuration file where
# it should appear only once). See also the "--disable" option for examples.
enable=
[REPORTS]
# Python expression which should return a note less than 10 (10 is the highest
# note). You have access to the variables errors warning, statement which
# respectively contain the number of errors / warnings messages and the total
# number of statements analyzed. This is used by the global evaluation report
# (RP0004).
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
# Template used to display messages. This is a python new-style format string
# used to format the message information. See doc for all details
#msg-template=
# Set the output format. Available formats are text, parseable, colorized, json
# and msvs (visual studio).You can also give a reporter class, eg
# mypackage.mymodule.MyReporterClass.
output-format=text
# Tells whether to display a full report or only the messages
reports=no
# Activate the evaluation score.
score=yes
[REFACTORING]
# Maximum number of nested blocks for function / method body
max-nested-blocks=5
[LOGGING]
# Logging modules to check that the string format arguments are in logging
# function parameter format
logging-modules=logging
[SPELLING]
# Spelling dictionary name. Available dictionaries: none. To make it working
# install python-enchant package.
spelling-dict=
# List of comma separated words that should not be checked.
spelling-ignore-words=
# A path to a file that contains private dictionary; one word per line.
spelling-private-dict-file=
# Tells whether to store unknown words to indicated private dictionary in
# --spelling-private-dict-file option instead of raising a message.
spelling-store-unknown-words=no
[MISCELLANEOUS]
# List of note tags to take in consideration, separated by a comma.
# notes=FIXME,XXX,TODO
notes=FIXME,XXX
[TYPECHECK]
# List of decorators that produce context managers, such as
# contextlib.contextmanager. Add to this list to register other decorators that
# produce valid context managers.
contextmanager-decorators=contextlib.contextmanager
# List of members which are set dynamically and missed by pylint inference
# system, and so shouldn't trigger E1101 when accessed. Python regular
# expressions are accepted.
generated-members=
# Tells whether missing members accessed in mixin class should be ignored. A
# mixin class is detected if its name ends with "mixin" (case insensitive).
ignore-mixin-members=yes
# This flag controls whether pylint should warn about no-member and similar
# checks whenever an opaque object is returned when inferring. The inference
# can return multiple potential results while evaluating a Python object, but
# some branches might not be evaluated, which results in partial inference. In
# that case, it might be useful to still emit no-member and other checks for
# the rest of the inferred objects.
ignore-on-opaque-inference=yes
# List of class names for which member attributes should not be checked (useful
# for classes with dynamically set attributes). This supports the use of
# qualified names.
ignored-classes=optparse.Values,thread._local,_thread._local
# List of module names for which member attributes should not be checked
# (useful for modules/projects where namespaces are manipulated during runtime
# and thus existing member attributes cannot be deduced by static analysis. It
# supports qualified module names, as well as Unix pattern matching.
ignored-modules=board
# Show a hint with possible names when a member name was not found. The aspect
# of finding the hint is based on edit distance.
missing-member-hint=yes
# The minimum edit distance a name should have in order to be considered a
# similar match for a missing member name.
missing-member-hint-distance=1
# The total number of similar names that should be taken in consideration when
# showing a hint for a missing member.
missing-member-max-choices=1
[VARIABLES]
# List of additional names supposed to be defined in builtins. Remember that
# you should avoid to define new builtins when possible.
additional-builtins=
# Tells whether unused global variables should be treated as a violation.
allow-global-unused-variables=yes
# List of strings which can identify a callback function by name. A callback
# name must start or end with one of those strings.
callbacks=cb_,_cb
# A regular expression matching the name of dummy variables (i.e. expectedly
# not used).
dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_
# Argument names that match this expression will be ignored. Default to name
# with leading underscore
ignored-argument-names=_.*|^ignored_|^unused_
# Tells whether we should check for unused import in __init__ files.
init-import=no
# List of qualified module names which can have objects that can redefine
# builtins.
redefining-builtins-modules=six.moves,future.builtins
[FORMAT]
# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
# expected-line-ending-format=
expected-line-ending-format=LF
# Regexp for a line that is allowed to be longer than the limit.
ignore-long-lines=^\s*(# )?<?https?://\S+>?$
# Number of spaces of indent required inside a hanging or continued line.
indent-after-paren=4
# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
# tab).
indent-string=' '
# Maximum number of characters on a single line.
max-line-length=100
# Maximum number of lines in a module
max-module-lines=1000
# List of optional constructs for which whitespace checking is disabled. `dict-
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
# `empty-line` allows space-only lines.
no-space-check=trailing-comma,dict-separator
# Allow the body of a class to be on the same line as the declaration if body
# contains single statement.
single-line-class-stmt=no
# Allow the body of an if to be on the same line as the test if there is no
# else.
single-line-if-stmt=no
[SIMILARITIES]
# Ignore comments when computing similarities.
ignore-comments=yes
# Ignore docstrings when computing similarities.
ignore-docstrings=yes
# Ignore imports when computing similarities.
ignore-imports=yes
# Minimum lines number of a similarity.
min-similarity-lines=4
[BASIC]
# Naming hint for argument names
argument-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Regular expression matching correct argument names
argument-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Naming hint for attribute names
attr-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Regular expression matching correct attribute names
attr-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Bad variable names which should always be refused, separated by a comma
bad-names=foo,bar,baz,toto,tutu,tata
# Naming hint for class attribute names
class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
# Regular expression matching correct class attribute names
class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
# Naming hint for class names
# class-name-hint=[A-Z_][a-zA-Z0-9]+$
class-name-hint=[A-Z_][a-zA-Z0-9_]+$
# Regular expression matching correct class names
# class-rgx=[A-Z_][a-zA-Z0-9]+$
class-rgx=[A-Z_][a-zA-Z0-9_]+$
# Naming hint for constant names
const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$
# Regular expression matching correct constant names
const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
# Minimum line length for functions/classes that require docstrings, shorter
# ones are exempt.
docstring-min-length=-1
# Naming hint for function names
function-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Regular expression matching correct function names
function-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Good variable names which should always be accepted, separated by a comma
# good-names=i,j,k,ex,Run,_
good-names=r,g,b,w,i,j,k,n,x,y,z,ex,ok,Run,_
# Include a hint for the correct naming format with invalid-name
include-naming-hint=no
# Naming hint for inline iteration names
inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$
# Regular expression matching correct inline iteration names
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
# Naming hint for method names
method-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Regular expression matching correct method names
method-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Naming hint for module names
module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
# Regular expression matching correct module names
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
# Colon-delimited sets of names that determine each other's naming style when
# the name regexes allow several styles.
name-group=
# Regular expression which should only match function or class names that do
# not require a docstring.
no-docstring-rgx=^_
# List of decorators that produce properties, such as abc.abstractproperty. Add
# to this list to register other decorators that produce valid properties.
property-classes=abc.abstractproperty
# Naming hint for variable names
variable-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Regular expression matching correct variable names
variable-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
[IMPORTS]
# Allow wildcard imports from modules that define __all__.
allow-wildcard-with-all=no
# Analyse import fallback blocks. This can be used to support both Python 2 and
# 3 compatible code, which means that the block might have code that exists
# only in one or another interpreter, leading to false positives when analysed.
analyse-fallback-blocks=no
# Deprecated modules which should not be used, separated by a comma
deprecated-modules=optparse,tkinter.tix
# Create a graph of external dependencies in the given file (report RP0402 must
# not be disabled)
ext-import-graph=
# Create a graph of every (i.e. internal and external) dependencies in the
# given file (report RP0402 must not be disabled)
import-graph=
# Create a graph of internal dependencies in the given file (report RP0402 must
# not be disabled)
int-import-graph=
# Force import order to recognize a module as part of the standard
# compatibility libraries.
known-standard-library=
# Force import order to recognize a module as part of a third party library.
known-third-party=enchant
[CLASSES]
# List of method names used to declare (i.e. assign) instance attributes.
defining-attr-methods=__init__,__new__,setUp
# List of member names, which should be excluded from the protected access
# warning.
exclude-protected=_asdict,_fields,_replace,_source,_make
# List of valid names for the first argument in a class method.
valid-classmethod-first-arg=cls
# List of valid names for the first argument in a metaclass class method.
valid-metaclass-classmethod-first-arg=mcs
[DESIGN]
# Maximum number of arguments for function / method
max-args=5
# Maximum number of attributes for a class (see R0902).
# max-attributes=7
max-attributes=11
# Maximum number of boolean expressions in a if statement
max-bool-expr=5
# Maximum number of branch for function / method body
max-branches=12
# Maximum number of locals for function / method body
max-locals=15
# Maximum number of parents for a class (see R0901).
max-parents=7
# Maximum number of public methods for a class (see R0904).
max-public-methods=20
# Maximum number of return / yield for function / method body
max-returns=6
# Maximum number of statements in function / method body
max-statements=50
# Minimum number of public methods for a class (see R0903).
min-public-methods=1
[EXCEPTIONS]
# Exceptions that will emit a warning when being caught. Defaults to
# "Exception"
overgeneral-exceptions=Exception

View file

@ -8,8 +8,15 @@
# Required
version: 2
sphinx:
configuration: docs/conf.py
build:
os: ubuntu-lts-latest
tools:
python: "3"
python:
version: "3.6"
install:
- requirements: docs/requirements.txt
- requirements: requirements.txt

View file

@ -3,11 +3,11 @@ Introduction
.. image:: https://readthedocs.org/projects/adafruit-circuitpython-uc8151d/badge/?version=latest
:target: https://circuitpython.readthedocs.io/projects/uc8151d/en/latest/
:target: https://docs.circuitpython.org/projects/uc8151d/en/latest/
:alt: Documentation Status
.. image:: https://img.shields.io/discord/327254708534116352.svg
.. image:: https://raw.githubusercontent.com/adafruit/Adafruit_CircuitPython_Bundle/main/badges/adafruit_discord.svg
:target: https://adafru.it/discord
:alt: Discord
@ -17,9 +17,9 @@ Introduction
:alt: Build Status
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black
:alt: Code Style: Black
.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
:target: https://github.com/astral-sh/ruff
:alt: Code Style: Ruff
CircuitPython `displayio` driver for US8151D-based ePaper displays
@ -63,8 +63,8 @@ To install in a virtual environment in your current project:
.. code-block:: shell
mkdir project-name && cd project-name
python3 -m venv .env
source .env/bin/activate
python3 -m venv .venv
source .venv/bin/activate
pip3 install adafruit-circuitpython-uc8151d
@ -84,7 +84,7 @@ following command to install:
.. code-block:: shell
circup install uc8151d
circup install adafruit_uc8151d
Or the following command to update an existing version:
@ -100,6 +100,7 @@ Usage Example
import time
import board
import displayio
import fourwire
import adafruit_uc8151d
displayio.release_displays()
@ -111,7 +112,7 @@ Usage Example
epd_reset = board.D5
epd_busy = None
display_bus = displayio.FourWire(
display_bus = fourwire.FourWire(
spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
)
time.sleep(1)
@ -122,22 +123,28 @@ Usage Example
g = displayio.Group()
with open("/display-ruler.bmp", "rb") as f:
pic = displayio.OnDiskBitmap(f)
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
g.append(t)
pic = displayio.OnDiskBitmap("/display-ruler.bmp")
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
g.append(t)
display.show(g)
# Place the display group on the screen
display.root_group = g
display.refresh()
# Refresh the display to have it actually show the image
# NOTE: Do not refresh eInk displays sooner than 180 seconds
display.refresh()
print("refreshed")
time.sleep(180)
time.sleep(120)
Documentation
=============
API documentation for this library can be found on `Read the Docs <https://circuitpython.readthedocs.io/projects/uc8151d/en/latest/>`_.
API documentation for this library can be found on `Read the Docs <https://docs.circuitpython.org/projects/uc8151d/en/latest/>`_.
For information on building library documentation, please check out `this guide <https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/sharing-our-docs-on-readthedocs#sphinx-5-1>`_.
Contributing
============
@ -145,9 +152,3 @@ Contributing
Contributions are welcome! Please read our `Code of Conduct
<https://github.com/adafruit/Adafruit_CircuitPython_UC8151D/blob/HEAD/CODE_OF_CONDUCT.md>`_
before contributing to help this project stay welcoming.
Documentation
=============
For information on building library documentation, please check out
`this guide <https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/sharing-our-docs-on-readthedocs#sphinx-5-1>`_.

100
adafruit_uc8151d.py Normal file → Executable file
View file

@ -17,6 +17,7 @@ Implementation Notes
**Hardware:**
* `Adafruit Flexible 2.9" Black and White <https://www.adafruit.com/product/4262>`_
* `Adafruit Tri-Color 2.9" <https://www.adafruit.com/product/1028>`_
**Software and Dependencies:**
@ -25,22 +26,90 @@ Implementation Notes
"""
import displayio
from epaperdisplay import EPaperDisplay
__version__ = "0.0.0-auto.0"
try:
import typing
from fourwire import FourWire
except ImportError:
pass
__version__ = "0.0.0+auto.0"
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_UC8151D.git"
_START_SEQUENCE = (
# b"\x01\x05\x03\x00\x2b\x2b\x09" # power setting
# b"\x06\x03\x17\x17\x17" # booster soft start
b"\x04\x80\xc8" # power on and wait 10 ms
b"\x04\x80\xc8" # power on and wait 200 ms
b"\x00\x01\x1f" # panel setting. Further filled in below.
b"\x50\x01\x97" # CDI setting
)
_STOP_SEQUENCE = b"\x50\x01\xf7" b"\x07\x01\xA5" # CDI setting # Deep Sleep
_COLOR_START_SEQUENCE = (
b"\x04\x80\xc8" # power on and wait 200 ms
b"\x00\x02\x0f\x89" # panel setting. Further filled in below.
b"\x61\x03\x80\x01\x28" # Set Display Resolution
b"\x50\x01\x77" # CDI setting
)
_GRAYSCALE_START_SEQUENCE = (
b"\x04\x80\xc8" # Power on
b"\x00\x01\xbf" # Panel setting
b"\x50\x01\x97" # CDI setting
# Common voltage
b"\x20\x2a"
b"\x00\x0a\x00\x00\x00\x01"
b"\x60\x14\x14\x00\x00\x01"
b"\x00\x14\x00\x00\x00\x01"
b"\x00\x13\x0a\x01\x00\x01"
b"\x00\x00\x00\x00\x00\x00"
b"\x00\x00\x00\x00\x00\x00"
b"\x00\x00\x00\x00\x00\x00"
# White to White
b"\x21\x2a"
b"\x40\x0a\x00\x00\x00\x01"
b"\x90\x14\x14\x00\x00\x01"
b"\x10\x14\x0a\x00\x00\x01"
b"\xa0\x13\x01\x00\x00\x01"
b"\x00\x00\x00\x00\x00\x00"
b"\x00\x00\x00\x00\x00\x00"
b"\x00\x00\x00\x00\x00\x00"
# Black to White
b"\x22\x2a"
b"\x40\x0a\x00\x00\x00\x01"
b"\x90\x14\x14\x00\x00\x01"
b"\x00\x14\x0a\x00\x00\x01"
b"\x99\x0b\x04\x04\x01\x01"
b"\x00\x00\x00\x00\x00\x00"
b"\x00\x00\x00\x00\x00\x00"
b"\x00\x00\x00\x00\x00\x00"
# White to Black
b"\x23\x2a"
b"\x40\x0a\x00\x00\x00\x01"
b"\x90\x14\x14\x00\x00\x01"
b"\x00\x14\x0a\x00\x00\x01"
b"\x99\x0c\x01\x03\x04\x01"
b"\x00\x00\x00\x00\x00\x00"
b"\x00\x00\x00\x00\x00\x00"
b"\x00\x00\x00\x00\x00\x00"
# Black to Black
b"\x24\x2a"
b"\x80\x0a\x00\x00\x00\x01"
b"\x90\x14\x14\x00\x00\x01"
b"\x20\x14\x0a\x00\x00\x01"
b"\x50\x13\x01\x00\x00\x01"
b"\x00\x00\x00\x00\x00\x00"
b"\x00\x00\x00\x00\x00\x00"
b"\x00\x00\x00\x00\x00\x00"
)
_STOP_SEQUENCE = b"\x50\x01\xf7" b"\x07\x01\xa5" # CDI setting # Deep Sleep
# pylint: disable=too-few-public-methods
class UC8151D(displayio.EPaperDisplay):
class UC8151D(EPaperDisplay):
r"""UC8151D driver
:param bus: The data bus the display is on
@ -56,7 +125,19 @@ class UC8151D(displayio.EPaperDisplay):
Display rotation
"""
def __init__(self, bus, **kwargs):
def __init__(self, bus: FourWire, **kwargs) -> None:
color_bits_inverted = kwargs.pop("color_bits_inverted", False)
write_color_ram_command = 0x10
write_black_ram_command = 0x13
if kwargs.get("grayscale", False):
start_sequence = bytearray(_GRAYSCALE_START_SEQUENCE)
elif kwargs.get("highlight_color", False):
write_color_ram_command = 0x13
write_black_ram_command = 0x10
color_bits_inverted = kwargs.pop("color_bits_inverted", True)
start_sequence = bytearray(_COLOR_START_SEQUENCE)
else:
start_sequence = bytearray(_START_SEQUENCE)
width = kwargs["width"]
height = kwargs["height"]
if "rotation" in kwargs and kwargs["rotation"] % 180 != 0:
@ -64,13 +145,14 @@ class UC8151D(displayio.EPaperDisplay):
super().__init__(
bus,
_START_SEQUENCE,
start_sequence,
_STOP_SEQUENCE,
**kwargs,
ram_width=128,
ram_height=296,
busy_state=False,
write_black_ram_command=0x13,
write_color_ram_command=0x10,
write_black_ram_command=write_black_ram_command,
write_color_ram_command=write_color_ram_command,
color_bits_inverted=color_bits_inverted,
refresh_display_command=0x12,
)

View file

@ -4,5 +4,8 @@
.. If your library file(s) are nested in a directory (e.g. /adafruit_foo/foo.py)
.. use this format as the module name: "adafruit_foo.foo"
API Reference
#############
.. automodule:: adafruit_uc8151d
:members:

View file

@ -1,9 +1,8 @@
# -*- coding: utf-8 -*-
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import datetime
import os
import sys
@ -16,6 +15,7 @@ sys.path.insert(0, os.path.abspath(".."))
# ones.
extensions = [
"sphinx.ext.autodoc",
"sphinxcontrib.jquery",
"sphinx.ext.intersphinx",
"sphinx.ext.napoleon",
"sphinx.ext.todo",
@ -25,12 +25,12 @@ extensions = [
# Uncomment the below if you use native CircuitPython modules such as
# digitalio, micropython and busio. List the modules you use. Without it, the
# autodoc module docs will fail to generate with a warning.
autodoc_mock_imports = ["displayio"]
autodoc_mock_imports = ["epaperdisplay", "fourwire"]
intersphinx_mapping = {
"python": ("https://docs.python.org/3.4", None),
"CircuitPython": ("https://circuitpython.readthedocs.io/en/latest/", None),
"python": ("https://docs.python.org/3", None),
"CircuitPython": ("https://docs.circuitpython.org/en/latest/", None),
}
# Show the docstring from both the class and its __init__() method.
@ -46,7 +46,12 @@ master_doc = "index"
# General information about the project.
project = "Adafruit CircuitPython UC8151D Library"
copyright = "2021 Melissa LeBlanc-Williams"
creation_year = "2021"
current_year = str(datetime.datetime.now().year)
year_duration = (
current_year if current_year == creation_year else creation_year + " - " + current_year
)
copyright = year_duration + " Melissa LeBlanc-Williams"
author = "Melissa LeBlanc-Williams"
# The version info for the project you're documenting, acts as replacement for
@ -63,7 +68,7 @@ release = "1.0"
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = "en"
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
@ -101,19 +106,9 @@ napoleon_numpy_docstring = False
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
import sphinx_rtd_theme
if not on_rtd: # only import and set the theme if we're building docs locally
try:
import sphinx_rtd_theme
html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), "."]
except:
html_theme = "default"
html_theme_path = ["."]
else:
html_theme_path = ["."]
html_theme = "sphinx_rtd_theme"
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,

View file

@ -1,8 +1,19 @@
Simple test
------------
Ensure your device works with this simple test.
Ensure your device works with this simple test. This simple test is for the 2.9" Flexible Monochrome display.
.. literalinclude:: ../examples/uc8151d_simpletest.py
:caption: examples/uc8151d_simpletest.py
:linenos:
Device Specific Examples
------------------------
.. literalinclude:: ../examples/uc8151d_1.54_grayscale.py
:caption: examples/uc8151d_1.54_grayscale.py
:linenos:
.. literalinclude:: ../examples/uc8151d_2.9_color.py
:caption: examples/uc8151d_2.9_color.py
:linenos:

View file

@ -34,8 +34,9 @@ Adafruit 2.9" Flexible 296x128 Monochrome eInk / ePaper Display <https://www.ada
.. toctree::
:caption: Other Links
Download <https://github.com/adafruit/Adafruit_CircuitPython_UC8151D/releases/latest>
CircuitPython Reference Documentation <https://circuitpython.readthedocs.io>
Download from GitHub <https://github.com/adafruit/Adafruit_CircuitPython_UC8151D/releases/latest>
Download Library Bundle <https://circuitpython.org/libraries>
CircuitPython Reference Documentation <https://docs.circuitpython.org>
CircuitPython Support Forum <https://forums.adafruit.com/viewforum.php?f=60>
Discord Chat <https://adafru.it/discord>
Adafruit Learning System <https://learn.adafruit.com>

View file

@ -2,4 +2,6 @@
#
# SPDX-License-Identifier: Unlicense
sphinx>=4.0.0
sphinx
sphinxcontrib-jquery
sphinx-rtd-theme

View file

@ -0,0 +1,69 @@
# SPDX-FileCopyrightText: 2022 Martin Refseth, written for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
"""Simple test script for 1.54" 152x152 grayscale display.
Supported products:
* 1.54" Grayscale Display (GDEW0154T8D)
"""
# pylint: disable=no-member
import time
import board
import busio
import displayio
from fourwire import FourWire
import adafruit_uc8151d
displayio.release_displays()
# Pinout intended for use with a Raspberry Pi Pico
clk = board.GP10
si = board.GP11
dc = board.GP8
cs = board.GP9
rst = board.GP12
busy = board.GP13
display_bus = FourWire(busio.SPI(clk, si), command=dc, chip_select=cs, reset=rst, baudrate=1000000)
time.sleep(1)
display = adafruit_uc8151d.UC8151D(
display_bus, width=152, height=152, busy_pin=busy, rotation=180, grayscale=True
)
bitmap = displayio.Bitmap(152, 152, 4)
# Draw Black
for x in range(0, 152):
for y in range(0, 38):
bitmap[x, y] = 0
# Draw Dark Gray
for x in range(0, 152):
for y in range(38, 76):
bitmap[x, y] = 1
# Draw Light Gray
for x in range(0, 152):
for y in range(76, 114):
bitmap[x, y] = 2
# Draw White
for x in range(0, 152):
for y in range(114, 152):
bitmap[x, y] = 3
palette = displayio.Palette(4)
palette[0] = 0x000000 # Black
palette[1] = 0x404040 # Dark Gray
palette[2] = 0x808080 # Light Gray
palette[3] = 0xFFFFFF # White
g = displayio.Group()
t = displayio.TileGrid(bitmap, pixel_shader=palette)
g.append(t)
display.root_group = g
display.refresh()

View file

@ -0,0 +1,59 @@
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
"""Simple test script for Adafruit 2.9" 296x128 tri-color display
Supported products:
* Adafruit 2.9" Tri-Color Display Breakout
* https://www.adafruit.com/product/1028
"""
import time
import board
import displayio
from fourwire import FourWire
import adafruit_uc8151d
# Used to ensure the display is free in CircuitPython
displayio.release_displays()
# Define the pins needed for display use
# This pinout is for a Feather M4 and may be different for other boards
spi = board.SPI() # Uses SCK and MOSI
epd_cs = board.D9
epd_dc = board.D10
epd_reset = board.D5
epd_busy = board.D6
# Create the displayio connection to the display pins
display_bus = 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_uc8151d.UC8151D(
display_bus,
width=296,
height=128,
rotation=270,
busy_pin=epd_busy,
highlight_color=0xFF0000,
)
# Create a display group for our screen objects
g = displayio.Group()
# Display a ruler graphic from the root directory of the CIRCUITPY drive
pic = displayio.OnDiskBitmap("/display-ruler.bmp")
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
g.append(t)
# Place the display group on the screen
display.root_group = g
# Refresh the display to have it actually show the image
# NOTE: Do not refresh eInk displays sooner than 180 seconds
display.refresh()
print("refreshed")
time.sleep(180)

View file

@ -8,12 +8,15 @@
Supported products:
* Adafruit Flexible 2.9" Monochrome
* https://www.adafruit.com/product/4262
"""
"""
# pylint: disable=no-member
import time
import board
import displayio
from fourwire import FourWire
import adafruit_uc8151d
displayio.release_displays()
@ -25,9 +28,7 @@ epd_dc = board.D10
epd_reset = board.D5
epd_busy = None
display_bus = displayio.FourWire(
spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
)
display_bus = FourWire(spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000)
time.sleep(1)
display = adafruit_uc8151d.UC8151D(
@ -36,13 +37,16 @@ display = adafruit_uc8151d.UC8151D(
g = displayio.Group()
with open("/display-ruler.bmp", "rb") as f:
pic = displayio.OnDiskBitmap(f)
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
g.append(t)
pic = displayio.OnDiskBitmap("/display-ruler.bmp")
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
g.append(t)
display.show(g)
# Place the display group on the screen
display.root_group = g
display.refresh()
# Refresh the display to have it actually show the image
# NOTE: Do not refresh eInk displays sooner than 180 seconds
display.refresh()
print("refreshed")
time.sleep(120)
time.sleep(180)

View file

@ -0,0 +1,3 @@
# SPDX-FileCopyrightText: 2022 Alec Delaney, for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense

View file

@ -1,6 +1,50 @@
# SPDX-FileCopyrightText: 2020 Diego Elio Pettenò
# SPDX-FileCopyrightText: 2022 Alec Delaney for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
# SPDX-License-Identifier: MIT
[tool.black]
target-version = ['py35']
[build-system]
requires = [
"setuptools",
"wheel",
"setuptools-scm",
]
[project]
name = "adafruit-circuitpython-uc8151d"
description = "CircuitPython `displayio` driver for US8151D-based ePaper displays"
version = "0.0.0+auto.0"
readme = "README.rst"
authors = [
{name = "Adafruit Industries", email = "circuitpython@adafruit.com"}
]
urls = {Homepage = "https://github.com/adafruit/Adafruit_CircuitPython_UC8151D.git"}
keywords = [
"adafruit",
"blinka",
"circuitpython",
"micropython",
"uc8151d",
"uc8151",
"us8151d",
"displayio",
"epd",
"epaper",
"flexible",
]
license = {text = "MIT"}
classifiers = [
"Intended Audience :: Developers",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Embedded Systems",
"Topic :: System :: Hardware",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
]
dynamic = ["dependencies", "optional-dependencies"]
[tool.setuptools]
py-modules = ["adafruit_uc8151d"]
[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}
optional-dependencies = {optional = {file = ["optional_requirements.txt"]}}

View file

@ -1,7 +1,6 @@
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
# SPDX-FileCopyrightText: Copyright (c) 2021 Melissa LeBlanc-Williams for Adafruit Industries
# SPDX-FileCopyrightText: 2022 Alec Delaney, for Adafruit Industries
#
# SPDX-License-Identifier: MIT
# SPDX-License-Identifier: Unlicense
Adafruit-Blinka
adafruit-blinka-displayio

100
ruff.toml Normal file
View file

@ -0,0 +1,100 @@
# SPDX-FileCopyrightText: 2024 Tim Cocks for Adafruit Industries
#
# SPDX-License-Identifier: MIT
target-version = "py38"
line-length = 100
[lint]
preview = true
select = ["I", "PL", "UP"]
extend-select = [
"D419", # empty-docstring
"E501", # line-too-long
"W291", # trailing-whitespace
"PLC0414", # useless-import-alias
"PLC2401", # non-ascii-name
"PLC2801", # unnecessary-dunder-call
"PLC3002", # unnecessary-direct-lambda-call
"E999", # syntax-error
"PLE0101", # return-in-init
"F706", # return-outside-function
"F704", # yield-outside-function
"PLE0116", # continue-in-finally
"PLE0117", # nonlocal-without-binding
"PLE0241", # duplicate-bases
"PLE0302", # unexpected-special-method-signature
"PLE0604", # invalid-all-object
"PLE0605", # invalid-all-format
"PLE0643", # potential-index-error
"PLE0704", # misplaced-bare-raise
"PLE1141", # dict-iter-missing-items
"PLE1142", # await-outside-async
"PLE1205", # logging-too-many-args
"PLE1206", # logging-too-few-args
"PLE1307", # bad-string-format-type
"PLE1310", # bad-str-strip-call
"PLE1507", # invalid-envvar-value
"PLE2502", # bidirectional-unicode
"PLE2510", # invalid-character-backspace
"PLE2512", # invalid-character-sub
"PLE2513", # invalid-character-esc
"PLE2514", # invalid-character-nul
"PLE2515", # invalid-character-zero-width-space
"PLR0124", # comparison-with-itself
"PLR0202", # no-classmethod-decorator
"PLR0203", # no-staticmethod-decorator
"UP004", # useless-object-inheritance
"PLR0206", # property-with-parameters
"PLR0904", # too-many-public-methods
"PLR0911", # too-many-return-statements
"PLR0912", # too-many-branches
"PLR0913", # too-many-arguments
"PLR0914", # too-many-locals
"PLR0915", # too-many-statements
"PLR0916", # too-many-boolean-expressions
"PLR1702", # too-many-nested-blocks
"PLR1704", # redefined-argument-from-local
"PLR1711", # useless-return
"C416", # unnecessary-comprehension
"PLR1733", # unnecessary-dict-index-lookup
"PLR1736", # unnecessary-list-index-lookup
# ruff reports this rule is unstable
#"PLR6301", # no-self-use
"PLW0108", # unnecessary-lambda
"PLW0120", # useless-else-on-loop
"PLW0127", # self-assigning-variable
"PLW0129", # assert-on-string-literal
"B033", # duplicate-value
"PLW0131", # named-expr-without-context
"PLW0245", # super-without-brackets
"PLW0406", # import-self
"PLW0602", # global-variable-not-assigned
"PLW0603", # global-statement
"PLW0604", # global-at-module-level
# fails on the try: import typing used by libraries
#"F401", # unused-import
"F841", # unused-variable
"E722", # bare-except
"PLW0711", # binary-op-exception
"PLW1501", # bad-open-mode
"PLW1508", # invalid-envvar-default
"PLW1509", # subprocess-popen-preexec-fn
"PLW2101", # useless-with-lock
"PLW3301", # nested-min-max
]
ignore = [
"PLR2004", # magic-value-comparison
"UP030", # format literals
"PLW1514", # unspecified-encoding
]
[format]
line-ending = "lf"

View file

@ -1,63 +0,0 @@
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
# SPDX-FileCopyrightText: Copyright (c) 2021 Melissa LeBlanc-Williams for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, "README.rst"), encoding="utf-8") as f:
long_description = f.read()
setup(
# Adafruit Bundle Information
name="adafruit-circuitpython-uc8151d",
use_scm_version=True,
setup_requires=["setuptools_scm"],
description="CircuitPython `displayio` driver for US8151D-based ePaper displays",
long_description=long_description,
long_description_content_type="text/x-rst",
# The project's main homepage.
url="https://github.com/adafruit/Adafruit_CircuitPython_UC8151D.git",
# Author details
author="Adafruit Industries",
author_email="circuitpython@adafruit.com",
install_requires=[
"Adafruit-Blinka",
"adafruit-blinka-displayio",
],
# Choose your license
license="MIT",
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Topic :: Software Development :: Libraries",
"Topic :: System :: Hardware",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
],
# What does your project relate to?
keywords="adafruit blinka circuitpython micropython uc8151d uc8151 us8151d displayio epd "
"epaper flexible",
# You can just specify the packages manually here if your project is
# simple. Or you can use find_packages().
# TODO: IF LIBRARY FILES ARE A PACKAGE FOLDER,
# CHANGE `py_modules=['...']` TO `packages=['...']`
py_modules=["adafruit_uc8151d"],
)