diff --git a/.github/PULL_REQUEST_TEMPLATE/adafruit_circuitpython_pr.md b/.github/PULL_REQUEST_TEMPLATE/adafruit_circuitpython_pr.md
new file mode 100644
index 0000000..8de294e
--- /dev/null
+++ b/.github/PULL_REQUEST_TEMPLATE/adafruit_circuitpython_pr.md
@@ -0,0 +1,13 @@
+# SPDX-FileCopyrightText: 2021 Adafruit Industries
+#
+# SPDX-License-Identifier: MIT
+
+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://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
+
+Before submitting the pull request, make sure you've run Pylint and Black locally on your code. You can do this manually or using pre-commit. Instructions are available here: https://adafru.it/check-your-code
+
+Please remove all of this text before submitting. Include an explanation or list of changes included in your PR, as well as, if applicable, a link to any related issues.
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 0434bc5..041a337 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -10,59 +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.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 dependencies
- # (e.g. - apt-get: gettext, etc; pip: circuitpython-build-tools, requirements.txt; etc.)
- run: |
- source actions-ci/install.sh
- - name: Pip install pylint, Sphinx, pre-commit
- run: |
- pip install --force-reinstall pylint Sphinx sphinx-rtd-theme pre-commit
- - name: Library version
- run: git describe --dirty --always --tags
- - 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: Build 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: Run Build CI workflow
+ uses: adafruit/workflows-circuitpython-libs/build@main
diff --git a/.github/workflows/failure-help-text.yml b/.github/workflows/failure-help-text.yml
new file mode 100644
index 0000000..0b1194f
--- /dev/null
+++ b/.github/workflows/failure-help-text.yml
@@ -0,0 +1,19 @@
+# SPDX-FileCopyrightText: 2021 Scott Shawcroft for Adafruit Industries
+#
+# SPDX-License-Identifier: MIT
+
+name: Failure help text
+
+on:
+ workflow_run:
+ workflows: ["Build CI"]
+ types:
+ - completed
+
+jobs:
+ post-help:
+ runs-on: ubuntu-latest
+ if: ${{ github.event.workflow_run.conclusion == 'failure' && github.event.workflow_run.event == 'pull_request' }}
+ steps:
+ - name: Post comment to help
+ uses: adafruit/circuitpython-action-library-ci-failed@v1
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
deleted file mode 100644
index 6d0015a..0000000
--- a/.github/workflows/release.yml
+++ /dev/null
@@ -1,85 +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
- twine upload dist/*
diff --git a/.github/workflows/release_gh.yml b/.github/workflows/release_gh.yml
new file mode 100644
index 0000000..9acec60
--- /dev/null
+++ b/.github/workflows/release_gh.yml
@@ -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 }}
diff --git a/.github/workflows/release_pypi.yml b/.github/workflows/release_pypi.yml
new file mode 100644
index 0000000..65775b7
--- /dev/null
+++ b/.github/workflows/release_pypi.yml
@@ -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 }}
diff --git a/.gitignore b/.gitignore
index 2c6ddfd..db3d538 100644
--- a/.gitignore
+++ b/.gitignore
@@ -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
+*~
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 354c761..70ade69 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -3,32 +3,40 @@
# SPDX-License-Identifier: Unlicense
repos:
-- repo: https://github.com/python/black
- rev: 20.8b1
+ - repo: https://github.com/python/black
+ rev: 23.3.0
hooks:
- - id: black
-- repo: https://github.com/fsfe/reuse-tool
- rev: v0.12.1
+ - id: black
+ - repo: https://github.com/fsfe/reuse-tool
+ rev: v1.1.2
hooks:
- - id: reuse
-- repo: https://github.com/pre-commit/pre-commit-hooks
- rev: v2.3.0
+ - id: reuse
+ - repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v4.4.0
hooks:
- - id: check-yaml
- - id: end-of-file-fixer
- - id: trailing-whitespace
-- repo: https://github.com/pycqa/pylint
- rev: pylint-2.7.1
+ - id: check-yaml
+ - id: end-of-file-fixer
+ - id: trailing-whitespace
+ - repo: https://github.com/pycqa/pylint
+ rev: v2.17.4
hooks:
- - id: pylint
+ - id: pylint
name: pylint (library code)
types: [python]
- exclude: "^(docs/|examples/|setup.py$)"
-- repo: local
- hooks:
- - id: pylint_examples
- name: pylint (examples code)
+ 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
- entry: /usr/bin/env bash -c
- args: ['([[ ! -d "examples" ]] || for example in $(find . -path "./examples/*.py"); do pylint --disable=missing-docstring,invalid-name $example; done)']
- language: system
+ 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
diff --git a/.pylintrc b/.pylintrc
index 9e69bd0..f945e92 100644
--- a/.pylintrc
+++ b/.pylintrc
@@ -9,11 +9,11 @@
# run arbitrary code
extension-pkg-whitelist=
-# Add files or directories to the blacklist. They should be base names, not
+# 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 blacklist. The
+# Add files or directories matching the regex patterns to the ignore-list. The
# regex matches against base names, not paths.
ignore-patterns=
@@ -26,7 +26,7 @@ jobs=1
# List of plugins (as comma separated values of python modules names) to load,
# usually to register additional checkers.
-load-plugins=
+load-plugins=pylint.extensions.no_self_use
# Pickle collected data for later comparisons.
persistent=yes
@@ -54,8 +54,8 @@ confidence=
# --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
+# disable=import-error,raw-checker-failed,bad-inline-option,locally-disabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,deprecated-str-translate-call
+disable=raw-checker-failed,bad-inline-option,locally-disabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,import-error,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
@@ -225,12 +225,6 @@ 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
@@ -257,38 +251,22 @@ min-similarity-lines=12
[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_]*)|(__.*__))$
@@ -296,9 +274,6 @@ const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
# 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_]*))$
@@ -309,21 +284,12 @@ 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]+))$
@@ -339,9 +305,6 @@ no-docstring-rgx=^_
# 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_]*))$
@@ -433,4 +396,4 @@ min-public-methods=1
# Exceptions that will emit a warning when being caught. Defaults to
# "Exception"
-overgeneral-exceptions=Exception
+overgeneral-exceptions=builtins.Exception
diff --git a/.readthedocs.yaml b/.readthedocs.yaml
new file mode 100644
index 0000000..88bca9f
--- /dev/null
+++ b/.readthedocs.yaml
@@ -0,0 +1,22 @@
+# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
+#
+# SPDX-License-Identifier: Unlicense
+
+# Read the Docs configuration file
+# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
+
+# Required
+version: 2
+
+sphinx:
+ configuration: docs/conf.py
+
+build:
+ os: ubuntu-20.04
+ tools:
+ python: "3"
+
+python:
+ install:
+ - requirements: docs/requirements.txt
+ - requirements: requirements.txt
diff --git a/.readthedocs.yml b/.readthedocs.yml
deleted file mode 100644
index a1e2575..0000000
--- a/.readthedocs.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
-#
-# SPDX-License-Identifier: Unlicense
-
-python:
- version: 3
-requirements_file: requirements.txt
diff --git a/README.rst b/README.rst
index 9dade1a..2ae604e 100644
--- a/README.rst
+++ b/README.rst
@@ -2,10 +2,10 @@ Introduction
============
.. image:: https://readthedocs.org/projects/adafruit-circuitpython-matrixportal/badge/?version=latest
- :target: https://circuitpython.readthedocs.io/projects/matrixportal/en/latest/
+ :target: https://docs.circuitpython.org/projects/matrixportal/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
@@ -68,14 +68,16 @@ Usage Example
# Scroll it
matrixportal.scroll_text(SCROLL_DELAY)
+Documentation
+=============
+
+API documentation for this library can be found on `Read the Docs `_.
+
+For information on building library documentation, please check out `this guide `_.
+
Contributing
============
Contributions are welcome! Please read our `Code of Conduct
-`_
+`_
before contributing to help this project stay welcoming.
-
-Documentation
-=============
-
-For information on building library documentation, please check out `this guide `_.
diff --git a/adafruit_matrixportal/__init__.py b/adafruit_matrixportal/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/adafruit_matrixportal/graphics.py b/adafruit_matrixportal/graphics.py
index 950dfb4..92b5767 100755
--- a/adafruit_matrixportal/graphics.py
+++ b/adafruit_matrixportal/graphics.py
@@ -29,7 +29,7 @@
from adafruit_portalbase.graphics import GraphicsBase
from adafruit_matrixportal.matrix import Matrix
-__version__ = "0.0.0-auto.0"
+__version__ = "0.0.0+auto.0"
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_MatrixPortal.git"
diff --git a/adafruit_matrixportal/matrix.py b/adafruit_matrixportal/matrix.py
index e285a97..d9cb86e 100755
--- a/adafruit_matrixportal/matrix.py
+++ b/adafruit_matrixportal/matrix.py
@@ -33,7 +33,7 @@
import framebufferio
-__version__ = "0.0.0-auto.0"
+__version__ = "0.0.0+auto.0"
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_MatrixPortal.git"
@@ -41,18 +41,19 @@ class Matrix:
"""Class representing the Adafruit RGB Matrix. This is used to automatically
initialize the display.
- :param int width: The width of the display in Pixels. Defaults to 64.
- :param int height: The height of the display in Pixels. Defaults to 32.
+ :param int width: The total width of the display(s) in Pixels. Defaults to 64.
+ :param int height: The total height of the display(s) in Pixels. Defaults to 32.
:param int bit_depth: The number of bits per color channel. Defaults to 2.
:param list alt_addr_pins: An alternate set of address pins to use. Defaults to None
:param string color_order: A string containing the letter "R", "G", and "B" in the
order you want. Defaults to "RGB"
- :param int width: The total width of the display(s) in Pixels. Defaults to 64.
- :param int height: The total height of the display(s) in Pixels. Defaults to 32.
- :param bool Serpentine: Used when panels are arranged in a serpentine pattern rather
+ :param bool serpentine: Used when panels are arranged in a serpentine pattern rather
than a Z-pattern. Defaults to True.
:param int tiles_rows: Used to indicate the number of rows the panels are arranged in.
Defaults to 1.
+ :param int rotation: The rotation of the display in degrees clockwise.
+ Must be in 90 degree increments (0, 90, 180, 270).
+ Defaults to 0.
"""
# pylint: disable=too-few-public-methods,too-many-branches,too-many-statements,too-many-locals
@@ -68,7 +69,6 @@ def __init__(
tile_rows=1,
rotation=0,
):
-
panel_height = height // tile_rows
if not isinstance(color_order, str):
@@ -80,8 +80,11 @@ def __init__(
if -1 in (red_index, green_index, blue_index):
raise ValueError("color_order should contain R, G, and B")
- if "Matrix Portal M4" in os.uname().machine:
- # MatrixPortal M4 Board
+ if (
+ "Adafruit Matrix Portal" in os.uname().machine
+ or "Adafruit MatrixPortal" in os.uname().machine
+ ):
+ # MatrixPortal Board
addr_pins = [board.MTX_ADDRA, board.MTX_ADDRB, board.MTX_ADDRC]
if panel_height > 16:
addr_pins.append(board.MTX_ADDRD)
@@ -138,8 +141,8 @@ def __init__(
board.D12,
]
clock_pin = board.D13
- latch_pin = board.D0
- oe_pin = board.D1
+ latch_pin = board.RX
+ oe_pin = board.TX
else:
# Metro/Grand Central Style Board
if alt_addr_pins is None and height <= 16:
diff --git a/adafruit_matrixportal/matrixportal.py b/adafruit_matrixportal/matrixportal.py
index c48ca19..902b8e0 100755
--- a/adafruit_matrixportal/matrixportal.py
+++ b/adafruit_matrixportal/matrixportal.py
@@ -33,7 +33,7 @@
from adafruit_matrixportal.network import Network
from adafruit_matrixportal.graphics import Graphics
-__version__ = "0.0.0-auto.0"
+__version__ = "0.0.0+auto.0"
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_MatrixPortal.git"
@@ -63,10 +63,10 @@ class MatrixPortal(PortalBase):
:param debug: Turn on debug print outs. Defaults to False.
:param int width: The total width of the display(s) in Pixels. Defaults to 64.
:param int height: The total height of the display(s) in Pixels. Defaults to 32.
- :param bool Serpentine: Used when panels are arranged in a serpentine pattern rather
+ :param bool serpentine: Used when panels are arranged in a serpentine pattern rather
than a Z-pattern. Defaults to True.
- :param int tiles_rows: Used to indicate the number of rows the panels are arranged in.
- Defaults to 1.
+ :param int tile_rows: Used to indicate the number of rows the panels are arranged in.
+ Defaults to 1.
"""
@@ -92,8 +92,8 @@ def __init__(
serpentine=True,
tile_rows=1,
rotation=0,
+ use_wifi=True,
):
-
graphics = Graphics(
default_bg=default_bg,
bit_depth=bit_depth,
@@ -107,13 +107,16 @@ def __init__(
debug=debug,
)
- network = Network(
- status_neopixel=status_neopixel,
- esp=esp,
- external_spi=external_spi,
- extract_values=False,
- debug=debug,
- )
+ if use_wifi:
+ network = Network(
+ status_neopixel=status_neopixel,
+ esp=esp,
+ external_spi=external_spi,
+ extract_values=False,
+ debug=debug,
+ )
+ else:
+ network = None
super().__init__(
network,
@@ -144,6 +147,7 @@ def add_text(
line_spacing=1.25,
text_anchor_point=(0, 0.5),
is_data=True,
+ text=None,
):
"""
Add text labels with settings
@@ -166,6 +170,11 @@ def add_text(
:param (float, float) text_anchor_point: Values between 0 and 1 to indicate where the text
position is relative to the label
:param bool is_data: If True, fetch will attempt to update the label
+ :param str text: If this is provided, it will set the initial text of the label.
+
+ :return: Index of the new text label.
+ :rtype: int
+
"""
if scrolling:
if text_position is None:
@@ -185,6 +194,7 @@ def add_text(
line_spacing=line_spacing,
text_anchor_point=text_anchor_point,
is_data=is_data,
+ text=text,
)
self._text[index]["scrolling"] = scrolling
diff --git a/adafruit_matrixportal/network.py b/adafruit_matrixportal/network.py
index 8d7b953..03f4504 100755
--- a/adafruit_matrixportal/network.py
+++ b/adafruit_matrixportal/network.py
@@ -26,11 +26,17 @@
"""
+import os
import gc
+import neopixel
from adafruit_portalbase.network import NetworkBase
-from adafruit_matrixportal.wifi import WiFi
-__version__ = "0.0.0-auto.0"
+if os.uname().sysname == "samd51":
+ from adafruit_portalbase.wifi_coprocessor import WiFi
+else:
+ from adafruit_portalbase.wifi_esp32s2 import WiFi
+
+__version__ = "0.0.0+auto.0"
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_MatrixPortal.git"
@@ -55,6 +61,19 @@ def __init__(self, **kwargs):
extract_values = kwargs.pop("extract_values")
if "debug" in kwargs:
debug = kwargs.pop("debug")
+
+ if os.uname().sysname != "samd51":
+ if "external_spi" in kwargs:
+ kwargs.pop("external_spi")
+ if "esp" in kwargs:
+ kwargs.pop("esp")
+
+ status_neopixel = kwargs.pop("status_neopixel", None)
+ if status_neopixel:
+ status_led = neopixel.NeoPixel(status_neopixel, 1, brightness=0.2)
+ else:
+ status_led = None
+ kwargs["status_led"] = status_led
wifi = WiFi(**kwargs)
super().__init__(
diff --git a/adafruit_matrixportal/wifi.py b/adafruit_matrixportal/wifi.py
deleted file mode 100755
index f298f39..0000000
--- a/adafruit_matrixportal/wifi.py
+++ /dev/null
@@ -1,118 +0,0 @@
-# SPDX-FileCopyrightText: 2020 Melissa LeBlanc-Williams, written for Adafruit Industries
-#
-# SPDX-License-Identifier: Unlicense
-"""
-`adafruit_matrixportal.wifi`
-================================================================================
-
-Helper library for the MatrixPortal M4 or Adafruit RGB Matrix Shield + Metro M4 Airlift Lite.
-
-* Author(s): Melissa LeBlanc-Williams
-
-Implementation Notes
---------------------
-
-**Hardware:**
-
-* `Adafruit MatrixPortal M4 `_
-* `Adafruit Metro M4 Express AirLift `_
-* `Adafruit RGB Matrix Shield `_
-* `64x32 RGB LED Matrix `_
-
-**Software and Dependencies:**
-
-* Adafruit CircuitPython firmware for the supported boards:
- https://github.com/adafruit/circuitpython/releases
-
-"""
-
-import gc
-import board
-import busio
-from digitalio import DigitalInOut
-import neopixel
-from adafruit_esp32spi import adafruit_esp32spi, adafruit_esp32spi_wifimanager
-import adafruit_esp32spi.adafruit_esp32spi_socket as socket
-import adafruit_requests as requests
-
-__version__ = "0.0.0-auto.0"
-__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_MatrixPortal.git"
-
-
-class WiFi:
- """Class representing the ESP.
-
- :param status_neopixel: The pin for the status NeoPixel. Use ``board.NEOPIXEL`` for the on-board
- NeoPixel. Defaults to ``None``, not the status LED
- :param esp: A passed ESP32 object, Can be used in cases where the ESP32 chip needs to be used
- before calling the pyportal class. Defaults to ``None``.
- :param busio.SPI external_spi: A previously declared spi object. Defaults to ``None``.
-
- """
-
- def __init__(self, *, status_neopixel=None, esp=None, external_spi=None):
-
- if status_neopixel:
- self.neopix = neopixel.NeoPixel(status_neopixel, 1, brightness=0.2)
- else:
- self.neopix = None
- self.neo_status(0)
- self.requests = None
-
- if esp: # If there was a passed ESP Object
- self.esp = esp
- if external_spi: # If SPI Object Passed
- spi = external_spi
- else: # Else: Make ESP32 connection
- spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
- else:
- esp32_ready = DigitalInOut(board.ESP_BUSY)
- esp32_gpio0 = DigitalInOut(board.ESP_GPIO0)
- esp32_reset = DigitalInOut(board.ESP_RESET)
- esp32_cs = DigitalInOut(board.ESP_CS)
- spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
-
- self.esp = adafruit_esp32spi.ESP_SPIcontrol(
- spi, esp32_cs, esp32_ready, esp32_reset, esp32_gpio0
- )
-
- requests.set_socket(socket, self.esp)
- if self.esp.is_connected:
- self.requests = requests
- self._manager = None
-
- gc.collect()
-
- def connect(self, ssid, password):
- """
- Connect to WiFi using the settings found in secrets.py
- """
- self.esp.connect({"ssid": ssid, "password": password})
- self.requests = requests
-
- def neo_status(self, value):
- """The status NeoPixel.
-
- :param value: The color to change the NeoPixel.
-
- """
- if self.neopix:
- self.neopix.fill(value)
-
- def manager(self, secrets):
- """Initialize the WiFi Manager if it hasn't been cached and return it"""
- if self._manager is None:
- self._manager = adafruit_esp32spi_wifimanager.ESPSPI_WiFiManager(
- self.esp, secrets, None
- )
- return self._manager
-
- @property
- def is_connected(self):
- """Return whether we are connected."""
- return self.esp.is_connected
-
- @property
- def enabled(self):
- """Not currently disablable on the ESP32 Coprocessor"""
- return True
diff --git a/docs/api.rst b/docs/api.rst
index 97f7fa8..9e5eecc 100644
--- a/docs/api.rst
+++ b/docs/api.rst
@@ -11,6 +11,3 @@
.. automodule:: adafruit_matrixportal.network
:members:
-
-.. automodule:: adafruit_matrixportal.wifi
- :members:
diff --git a/docs/conf.py b/docs/conf.py
index cdafadb..f8db1a2 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -6,6 +6,7 @@
import os
import sys
+import datetime
sys.path.insert(0, os.path.abspath(".."))
@@ -16,6 +17,7 @@
# ones.
extensions = [
"sphinx.ext.autodoc",
+ "sphinxcontrib.jquery",
"sphinx.ext.intersphinx",
"sphinx.ext.napoleon",
"sphinx.ext.todo",
@@ -25,12 +27,21 @@
# 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 = ["supervisor", "rtc", "rgbmatrix", "framebufferio", "secrets"]
+autodoc_mock_imports = [
+ "supervisor",
+ "rtc",
+ "rgbmatrix",
+ "framebufferio",
+ "wifi",
+ "ssl",
+ "socketpool",
+ "bitmaptools",
+]
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),
}
# Add any paths that contain templates here, relative to this directory.
@@ -43,7 +54,14 @@
# General information about the project.
project = "Adafruit MatrixPortal Library"
-copyright = "2020 Melissa LeBlanc-Williams"
+creation_year = "2020"
+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
@@ -60,7 +78,7 @@
#
# 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.
@@ -98,19 +116,9 @@
# 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"
-
-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 = ["."]
+import sphinx_rtd_theme
+
+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,
diff --git a/docs/index.rst b/docs/index.rst
index 8b689cc..b48674c 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -41,8 +41,9 @@ Table of Contents
.. toctree::
:caption: Other Links
- Download
- CircuitPython Reference Documentation
+ Download from GitHub
+ Download Library Bundle
+ CircuitPython Reference Documentation
CircuitPython Support Forum
Discord Chat
Adafruit Learning System
diff --git a/docs/requirements.txt b/docs/requirements.txt
new file mode 100644
index 0000000..979f568
--- /dev/null
+++ b/docs/requirements.txt
@@ -0,0 +1,7 @@
+# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
+#
+# SPDX-License-Identifier: Unlicense
+
+sphinx
+sphinxcontrib-jquery
+sphinx-rtd-theme
diff --git a/optional_requirements.txt b/optional_requirements.txt
new file mode 100644
index 0000000..d4e27c4
--- /dev/null
+++ b/optional_requirements.txt
@@ -0,0 +1,3 @@
+# SPDX-FileCopyrightText: 2022 Alec Delaney, for Adafruit Industries
+#
+# SPDX-License-Identifier: Unlicense
diff --git a/pyproject.toml b/pyproject.toml
index f3c35ae..9a74f8b 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -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-matrixportal"
+description = "CircuitPython helper for Adafruit MatrixPortal M4, Adafruit RGB Matrix Shield + Metro M4 Airlift Lite, and Adafruit RGB Matrix FeatherWings"
+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_MatrixPortal"}
+keywords = [
+ "adafruit",
+ "matrixportal",
+ "matrix",
+ "rgb",
+ "led",
+ "feather",
+ "featherwing",
+ "shieldbreakout",
+ "hardware",
+ "micropython",
+ "circuitpython",
+]
+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]
+packages = ["adafruit_matrixportal"]
+
+[tool.setuptools.dynamic]
+dependencies = {file = ["requirements.txt"]}
+optional-dependencies = {optional = {file = ["optional_requirements.txt"]}}
diff --git a/requirements.txt b/requirements.txt
index ff8852f..2b58ffe 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,14 +1,13 @@
-# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
-# SPDX-FileCopyrightText: Copyright (c) 2020 Melissa LeBlanc-Williams for Adafruit Industries
+# SPDX-FileCopyrightText: 2022 Alec Delaney, for Adafruit Industries
#
-# SPDX-License-Identifier: MIT
+# SPDX-License-Identifier: Unlicense
+Adafruit-Blinka-displayio
Adafruit-Blinka
-adafruit-blinka-displayio
-adafruit-circuitpython-portalbase
-adafruit-circuitpython-esp32spi
adafruit-circuitpython-bitmap-font
adafruit-circuitpython-display-text
+adafruit-circuitpython-esp32spi
adafruit-circuitpython-adafruitio
-adafruit-circuitpython-neopixel
adafruit-circuitpython-requests
+adafruit-circuitpython-neopixel
+adafruit-circuitpython-portalbase
diff --git a/setup.py.disabled b/setup.py.disabled
deleted file mode 100644
index 4d6d42a..0000000
--- a/setup.py.disabled
+++ /dev/null
@@ -1,9 +0,0 @@
-# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
-# SPDX-FileCopyrightText: Copyright (c) 2020 Melissa LeBlanc-Williams for Adafruit Industries
-#
-# SPDX-License-Identifier: MIT
-
-"""
-This library is not deployed to PyPI. It is either a board-specific helper library, or
-does not make sense for use on or is incompatible with single board computers and Linux.
-"""