Merge branch 'main' into timed-animation
This commit is contained in:
commit
fe11f17986
69 changed files with 1528 additions and 746 deletions
13
.github/PULL_REQUEST_TEMPLATE/adafruit_circuitpython_pr.md
vendored
Normal file
13
.github/PULL_REQUEST_TEMPLATE/adafruit_circuitpython_pr.md
vendored
Normal file
|
|
@ -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://circuitpython.readthedocs.io/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.
|
||||
55
.github/workflows/build.yml
vendored
55
.github/workflows/build.yml
vendored
|
|
@ -1,3 +1,7 @@
|
|||
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
name: Build CI
|
||||
|
||||
on: [pull_request, push]
|
||||
|
|
@ -6,52 +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, black, & Sphinx
|
||||
run: |
|
||||
pip install --force-reinstall pylint black==19.10b0 Sphinx sphinx-rtd-theme
|
||||
- name: Library version
|
||||
run: git describe --dirty --always --tags
|
||||
- name: Check formatting
|
||||
run: |
|
||||
black --check --target-version=py35 .
|
||||
- name: PyLint
|
||||
run: |
|
||||
pylint $( find . -path './adafruit*.py' )
|
||||
([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name,bad-whitespace $( find . -path "./examples/*.py" ))
|
||||
- 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: Run Build CI workflow
|
||||
uses: adafruit/workflows-circuitpython-libs/build@main
|
||||
|
|
|
|||
19
.github/workflows/failure-help-text.yml
vendored
Normal file
19
.github/workflows/failure-help-text.yml
vendored
Normal file
|
|
@ -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
|
||||
81
.github/workflows/release.yml
vendored
81
.github/workflows/release.yml
vendored
|
|
@ -1,81 +0,0 @@
|
|||
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/*
|
||||
19
.github/workflows/release_gh.yml
vendored
Normal file
19
.github/workflows/release_gh.yml
vendored
Normal 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
19
.github/workflows/release_pypi.yml
vendored
Normal 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 }}
|
||||
47
.gitignore
vendored
47
.gitignore
vendored
|
|
@ -1,5 +1,48 @@
|
|||
# SPDX-FileCopyrightText: 2022 Kattni Rembor, written for Adafruit Industries
|
||||
#
|
||||
# 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
|
||||
|
||||
# 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
|
||||
bundles
|
||||
.venv
|
||||
|
||||
# MacOS-specific files
|
||||
*.DS_Store
|
||||
|
||||
# IDE-specific files
|
||||
.idea
|
||||
.vscode
|
||||
*~
|
||||
|
|
|
|||
42
.pre-commit-config.yaml
Normal file
42
.pre-commit-config.yaml
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
# SPDX-FileCopyrightText: 2020 Diego Elio Pettenò
|
||||
#
|
||||
# SPDX-License-Identifier: Unlicense
|
||||
|
||||
repos:
|
||||
- repo: https://github.com/python/black
|
||||
rev: 23.3.0
|
||||
hooks:
|
||||
- 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: v4.4.0
|
||||
hooks:
|
||||
- id: check-yaml
|
||||
- id: end-of-file-fixer
|
||||
- id: trailing-whitespace
|
||||
- repo: https://github.com/pycqa/pylint
|
||||
rev: v2.17.4
|
||||
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
|
||||
60
.pylintrc
60
.pylintrc
|
|
@ -1,3 +1,7 @@
|
|||
# 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
|
||||
|
|
@ -5,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=
|
||||
|
||||
|
|
@ -18,12 +22,11 @@ ignore-patterns=
|
|||
#init-hook=
|
||||
|
||||
# Use multiple processes to speed up Pylint.
|
||||
# jobs=1
|
||||
jobs=2
|
||||
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
|
||||
|
|
@ -51,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
|
||||
|
|
@ -222,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
|
||||
|
|
@ -246,46 +243,30 @@ ignore-comments=yes
|
|||
ignore-docstrings=yes
|
||||
|
||||
# Ignore imports when computing similarities.
|
||||
ignore-imports=no
|
||||
ignore-imports=yes
|
||||
|
||||
# Minimum lines number of a similarity.
|
||||
min-similarity-lines=4
|
||||
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_]*)|(__.*__))$
|
||||
|
||||
|
|
@ -293,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_]*))$
|
||||
|
||||
|
|
@ -306,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]+))$
|
||||
|
||||
|
|
@ -336,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_]*))$
|
||||
|
||||
|
|
@ -430,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
|
||||
|
|
|
|||
19
.readthedocs.yaml
Normal file
19
.readthedocs.yaml
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# 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
|
||||
|
||||
build:
|
||||
os: ubuntu-20.04
|
||||
tools:
|
||||
python: "3"
|
||||
|
||||
python:
|
||||
install:
|
||||
- requirements: docs/requirements.txt
|
||||
- requirements: requirements.txt
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
python:
|
||||
version: 3
|
||||
requirements_file: requirements.txt
|
||||
|
|
@ -1,3 +1,9 @@
|
|||
<!--
|
||||
SPDX-FileCopyrightText: 2014 Coraline Ada Ehmke
|
||||
SPDX-FileCopyrightText: 2019 Kattni Rembor for Adafruit Industries
|
||||
SPDX-License-Identifier: CC-BY-4.0
|
||||
-->
|
||||
|
||||
# Adafruit Community Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
|
@ -43,7 +49,7 @@ Examples of unacceptable behavior by participants include:
|
|||
|
||||
The goal of the standards and moderation guidelines outlined here is to build
|
||||
and maintain a respectful community. We ask that you don’t just aim to be
|
||||
"technically unimpeachable", but rather try to be your best self.
|
||||
"technically unimpeachable", but rather try to be your best self.
|
||||
|
||||
We value many things beyond technical expertise, including collaboration and
|
||||
supporting others within our community. Providing a positive experience for
|
||||
|
|
@ -74,9 +80,9 @@ You may report in the following ways:
|
|||
In any situation, you may send an email to <support@adafruit.com>.
|
||||
|
||||
On the Adafruit Discord, you may send an open message from any channel
|
||||
to all Community Moderators by tagging @community moderators. You may
|
||||
also send an open message from any channel, or a direct message to
|
||||
@kattni#1507, @tannewt#4653, @Dan Halbert#1614, @cater#2442,
|
||||
to all Community Moderators by tagging @community moderators. You may
|
||||
also send an open message from any channel, or a direct message to
|
||||
@kattni#1507, @tannewt#4653, @Dan Halbert#1614, @cater#2442,
|
||||
@sommersoft#0222, @Mr. Certainly#0472 or @Andon#8175.
|
||||
|
||||
Email and direct message reports will be kept confidential.
|
||||
|
|
|
|||
324
LICENSES/CC-BY-4.0.txt
Normal file
324
LICENSES/CC-BY-4.0.txt
Normal file
|
|
@ -0,0 +1,324 @@
|
|||
Creative Commons Attribution 4.0 International Creative Commons Corporation
|
||||
("Creative Commons") is not a law firm and does not provide legal services
|
||||
or legal advice. Distribution of Creative Commons public licenses does not
|
||||
create a lawyer-client or other relationship. Creative Commons makes its licenses
|
||||
and related information available on an "as-is" basis. Creative Commons gives
|
||||
no warranties regarding its licenses, any material licensed under their terms
|
||||
and conditions, or any related information. Creative Commons disclaims all
|
||||
liability for damages resulting from their use to the fullest extent possible.
|
||||
|
||||
Using Creative Commons Public Licenses
|
||||
|
||||
Creative Commons public licenses provide a standard set of terms and conditions
|
||||
that creators and other rights holders may use to share original works of
|
||||
authorship and other material subject to copyright and certain other rights
|
||||
specified in the public license below. The following considerations are for
|
||||
informational purposes only, are not exhaustive, and do not form part of our
|
||||
licenses.
|
||||
|
||||
Considerations for licensors: Our public licenses are intended for use by
|
||||
those authorized to give the public permission to use material in ways otherwise
|
||||
restricted by copyright and certain other rights. Our licenses are irrevocable.
|
||||
Licensors should read and understand the terms and conditions of the license
|
||||
they choose before applying it. Licensors should also secure all rights necessary
|
||||
before applying our licenses so that the public can reuse the material as
|
||||
expected. Licensors should clearly mark any material not subject to the license.
|
||||
This includes other CC-licensed material, or material used under an exception
|
||||
or limitation to copyright. More considerations for licensors : wiki.creativecommons.org/Considerations_for_licensors
|
||||
|
||||
Considerations for the public: By using one of our public licenses, a licensor
|
||||
grants the public permission to use the licensed material under specified
|
||||
terms and conditions. If the licensor's permission is not necessary for any
|
||||
reason–for example, because of any applicable exception or limitation to copyright–then
|
||||
that use is not regulated by the license. Our licenses grant only permissions
|
||||
under copyright and certain other rights that a licensor has authority to
|
||||
grant. Use of the licensed material may still be restricted for other reasons,
|
||||
including because others have copyright or other rights in the material. A
|
||||
licensor may make special requests, such as asking that all changes be marked
|
||||
or described. Although not required by our licenses, you are encouraged to
|
||||
respect those requests where reasonable. More considerations for the public
|
||||
: wiki.creativecommons.org/Considerations_for_licensees Creative Commons Attribution
|
||||
4.0 International Public License
|
||||
|
||||
By exercising the Licensed Rights (defined below), You accept and agree to
|
||||
be bound by the terms and conditions of this Creative Commons Attribution
|
||||
4.0 International Public License ("Public License"). To the extent this Public
|
||||
License may be interpreted as a contract, You are granted the Licensed Rights
|
||||
in consideration of Your acceptance of these terms and conditions, and the
|
||||
Licensor grants You such rights in consideration of benefits the Licensor
|
||||
receives from making the Licensed Material available under these terms and
|
||||
conditions.
|
||||
|
||||
Section 1 – Definitions.
|
||||
|
||||
a. Adapted Material means material subject to Copyright and Similar Rights
|
||||
that is derived from or based upon the Licensed Material and in which the
|
||||
Licensed Material is translated, altered, arranged, transformed, or otherwise
|
||||
modified in a manner requiring permission under the Copyright and Similar
|
||||
Rights held by the Licensor. For purposes of this Public License, where the
|
||||
Licensed Material is a musical work, performance, or sound recording, Adapted
|
||||
Material is always produced where the Licensed Material is synched in timed
|
||||
relation with a moving image.
|
||||
|
||||
b. Adapter's License means the license You apply to Your Copyright and Similar
|
||||
Rights in Your contributions to Adapted Material in accordance with the terms
|
||||
and conditions of this Public License.
|
||||
|
||||
c. Copyright and Similar Rights means copyright and/or similar rights closely
|
||||
related to copyright including, without limitation, performance, broadcast,
|
||||
sound recording, and Sui Generis Database Rights, without regard to how the
|
||||
rights are labeled or categorized. For purposes of this Public License, the
|
||||
rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
|
||||
|
||||
d. Effective Technological Measures means those measures that, in the absence
|
||||
of proper authority, may not be circumvented under laws fulfilling obligations
|
||||
under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996,
|
||||
and/or similar international agreements.
|
||||
|
||||
e. Exceptions and Limitations means fair use, fair dealing, and/or any other
|
||||
exception or limitation to Copyright and Similar Rights that applies to Your
|
||||
use of the Licensed Material.
|
||||
|
||||
f. Licensed Material means the artistic or literary work, database, or other
|
||||
material to which the Licensor applied this Public License.
|
||||
|
||||
g. Licensed Rights means the rights granted to You subject to the terms and
|
||||
conditions of this Public License, which are limited to all Copyright and
|
||||
Similar Rights that apply to Your use of the Licensed Material and that the
|
||||
Licensor has authority to license.
|
||||
|
||||
h. Licensor means the individual(s) or entity(ies) granting rights under this
|
||||
Public License.
|
||||
|
||||
i. Share means to provide material to the public by any means or process that
|
||||
requires permission under the Licensed Rights, such as reproduction, public
|
||||
display, public performance, distribution, dissemination, communication, or
|
||||
importation, and to make material available to the public including in ways
|
||||
that members of the public may access the material from a place and at a time
|
||||
individually chosen by them.
|
||||
|
||||
j. Sui Generis Database Rights means rights other than copyright resulting
|
||||
from Directive 96/9/EC of the European Parliament and of the Council of 11
|
||||
March 1996 on the legal protection of databases, as amended and/or succeeded,
|
||||
as well as other essentially equivalent rights anywhere in the world.
|
||||
|
||||
k. You means the individual or entity exercising the Licensed Rights under
|
||||
this Public License. Your has a corresponding meaning.
|
||||
|
||||
Section 2 – Scope.
|
||||
|
||||
a. License grant.
|
||||
|
||||
1. Subject to the terms and conditions of this Public License, the Licensor
|
||||
hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive,
|
||||
irrevocable license to exercise the Licensed Rights in the Licensed Material
|
||||
to:
|
||||
|
||||
A. reproduce and Share the Licensed Material, in whole or in part; and
|
||||
|
||||
B. produce, reproduce, and Share Adapted Material.
|
||||
|
||||
2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions
|
||||
and Limitations apply to Your use, this Public License does not apply, and
|
||||
You do not need to comply with its terms and conditions.
|
||||
|
||||
3. Term. The term of this Public License is specified in Section 6(a).
|
||||
|
||||
4. Media and formats; technical modifications allowed. The Licensor authorizes
|
||||
You to exercise the Licensed Rights in all media and formats whether now known
|
||||
or hereafter created, and to make technical modifications necessary to do
|
||||
so. The Licensor waives and/or agrees not to assert any right or authority
|
||||
to forbid You from making technical modifications necessary to exercise the
|
||||
Licensed Rights, including technical modifications necessary to circumvent
|
||||
Effective Technological Measures. For purposes of this Public License, simply
|
||||
making modifications authorized by this Section 2(a)(4) never produces Adapted
|
||||
Material.
|
||||
|
||||
5. Downstream recipients.
|
||||
|
||||
A. Offer from the Licensor – Licensed Material. Every recipient of the Licensed
|
||||
Material automatically receives an offer from the Licensor to exercise the
|
||||
Licensed Rights under the terms and conditions of this Public License.
|
||||
|
||||
B. No downstream restrictions. You may not offer or impose any additional
|
||||
or different terms or conditions on, or apply any Effective Technological
|
||||
Measures to, the Licensed Material if doing so restricts exercise of the Licensed
|
||||
Rights by any recipient of the Licensed Material.
|
||||
|
||||
6. No endorsement. Nothing in this Public License constitutes or may be construed
|
||||
as permission to assert or imply that You are, or that Your use of the Licensed
|
||||
Material is, connected with, or sponsored, endorsed, or granted official status
|
||||
by, the Licensor or others designated to receive attribution as provided in
|
||||
Section 3(a)(1)(A)(i).
|
||||
|
||||
b. Other rights.
|
||||
|
||||
1. Moral rights, such as the right of integrity, are not licensed under this
|
||||
Public License, nor are publicity, privacy, and/or other similar personality
|
||||
rights; however, to the extent possible, the Licensor waives and/or agrees
|
||||
not to assert any such rights held by the Licensor to the limited extent necessary
|
||||
to allow You to exercise the Licensed Rights, but not otherwise.
|
||||
|
||||
2. Patent and trademark rights are not licensed under this Public License.
|
||||
|
||||
3. To the extent possible, the Licensor waives any right to collect royalties
|
||||
from You for the exercise of the Licensed Rights, whether directly or through
|
||||
a collecting society under any voluntary or waivable statutory or compulsory
|
||||
licensing scheme. In all other cases the Licensor expressly reserves any right
|
||||
to collect such royalties.
|
||||
|
||||
Section 3 – License Conditions.
|
||||
|
||||
Your exercise of the Licensed Rights is expressly made subject to the following
|
||||
conditions.
|
||||
|
||||
a. Attribution.
|
||||
|
||||
1. If You Share the Licensed Material (including in modified form), You must:
|
||||
|
||||
A. retain the following if it is supplied by the Licensor with the Licensed
|
||||
Material:
|
||||
|
||||
i. identification of the creator(s) of the Licensed Material and any others
|
||||
designated to receive attribution, in any reasonable manner requested by the
|
||||
Licensor (including by pseudonym if designated);
|
||||
|
||||
ii. a copyright notice;
|
||||
|
||||
iii. a notice that refers to this Public License;
|
||||
|
||||
iv. a notice that refers to the disclaimer of warranties;
|
||||
|
||||
v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
|
||||
|
||||
B. indicate if You modified the Licensed Material and retain an indication
|
||||
of any previous modifications; and
|
||||
|
||||
C. indicate the Licensed Material is licensed under this Public License, and
|
||||
include the text of, or the URI or hyperlink to, this Public License.
|
||||
|
||||
2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner
|
||||
based on the medium, means, and context in which You Share the Licensed Material.
|
||||
For example, it may be reasonable to satisfy the conditions by providing a
|
||||
URI or hyperlink to a resource that includes the required information.
|
||||
|
||||
3. If requested by the Licensor, You must remove any of the information required
|
||||
by Section 3(a)(1)(A) to the extent reasonably practicable.
|
||||
|
||||
4. If You Share Adapted Material You produce, the Adapter's License You apply
|
||||
must not prevent recipients of the Adapted Material from complying with this
|
||||
Public License.
|
||||
|
||||
Section 4 – Sui Generis Database Rights.
|
||||
|
||||
Where the Licensed Rights include Sui Generis Database Rights that apply to
|
||||
Your use of the Licensed Material:
|
||||
|
||||
a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract,
|
||||
reuse, reproduce, and Share all or a substantial portion of the contents of
|
||||
the database;
|
||||
|
||||
b. if You include all or a substantial portion of the database contents in
|
||||
a database in which You have Sui Generis Database Rights, then the database
|
||||
in which You have Sui Generis Database Rights (but not its individual contents)
|
||||
is Adapted Material; and
|
||||
|
||||
c. You must comply with the conditions in Section 3(a) if You Share all or
|
||||
a substantial portion of the contents of the database.
|
||||
|
||||
For the avoidance of doubt, this Section 4 supplements and does not replace
|
||||
Your obligations under this Public License where the Licensed Rights include
|
||||
other Copyright and Similar Rights.
|
||||
|
||||
Section 5 – Disclaimer of Warranties and Limitation of Liability.
|
||||
|
||||
a. Unless otherwise separately undertaken by the Licensor, to the extent possible,
|
||||
the Licensor offers the Licensed Material as-is and as-available, and makes
|
||||
no representations or warranties of any kind concerning the Licensed Material,
|
||||
whether express, implied, statutory, or other. This includes, without limitation,
|
||||
warranties of title, merchantability, fitness for a particular purpose, non-infringement,
|
||||
absence of latent or other defects, accuracy, or the presence or absence of
|
||||
errors, whether or not known or discoverable. Where disclaimers of warranties
|
||||
are not allowed in full or in part, this disclaimer may not apply to You.
|
||||
|
||||
b. To the extent possible, in no event will the Licensor be liable to You
|
||||
on any legal theory (including, without limitation, negligence) or otherwise
|
||||
for any direct, special, indirect, incidental, consequential, punitive, exemplary,
|
||||
or other losses, costs, expenses, or damages arising out of this Public License
|
||||
or use of the Licensed Material, even if the Licensor has been advised of
|
||||
the possibility of such losses, costs, expenses, or damages. Where a limitation
|
||||
of liability is not allowed in full or in part, this limitation may not apply
|
||||
to You.
|
||||
|
||||
c. The disclaimer of warranties and limitation of liability provided above
|
||||
shall be interpreted in a manner that, to the extent possible, most closely
|
||||
approximates an absolute disclaimer and waiver of all liability.
|
||||
|
||||
Section 6 – Term and Termination.
|
||||
|
||||
a. This Public License applies for the term of the Copyright and Similar Rights
|
||||
licensed here. However, if You fail to comply with this Public License, then
|
||||
Your rights under this Public License terminate automatically.
|
||||
|
||||
b. Where Your right to use the Licensed Material has terminated under Section
|
||||
6(a), it reinstates:
|
||||
|
||||
1. automatically as of the date the violation is cured, provided it is cured
|
||||
within 30 days of Your discovery of the violation; or
|
||||
|
||||
2. upon express reinstatement by the Licensor.
|
||||
|
||||
c. For the avoidance of doubt, this Section 6(b) does not affect any right
|
||||
the Licensor may have to seek remedies for Your violations of this Public
|
||||
License.
|
||||
|
||||
d. For the avoidance of doubt, the Licensor may also offer the Licensed Material
|
||||
under separate terms or conditions or stop distributing the Licensed Material
|
||||
at any time; however, doing so will not terminate this Public License.
|
||||
|
||||
e. Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
|
||||
|
||||
Section 7 – Other Terms and Conditions.
|
||||
|
||||
a. The Licensor shall not be bound by any additional or different terms or
|
||||
conditions communicated by You unless expressly agreed.
|
||||
|
||||
b. Any arrangements, understandings, or agreements regarding the Licensed
|
||||
Material not stated herein are separate from and independent of the terms
|
||||
and conditions of this Public License.
|
||||
|
||||
Section 8 – Interpretation.
|
||||
|
||||
a. For the avoidance of doubt, this Public License does not, and shall not
|
||||
be interpreted to, reduce, limit, restrict, or impose conditions on any use
|
||||
of the Licensed Material that could lawfully be made without permission under
|
||||
this Public License.
|
||||
|
||||
b. To the extent possible, if any provision of this Public License is deemed
|
||||
unenforceable, it shall be automatically reformed to the minimum extent necessary
|
||||
to make it enforceable. If the provision cannot be reformed, it shall be severed
|
||||
from this Public License without affecting the enforceability of the remaining
|
||||
terms and conditions.
|
||||
|
||||
c. No term or condition of this Public License will be waived and no failure
|
||||
to comply consented to unless expressly agreed to by the Licensor.
|
||||
|
||||
d. Nothing in this Public License constitutes or may be interpreted as a limitation
|
||||
upon, or waiver of, any privileges and immunities that apply to the Licensor
|
||||
or You, including from the legal processes of any jurisdiction or authority.
|
||||
|
||||
Creative Commons is not a party to its public licenses. Notwithstanding, Creative
|
||||
Commons may elect to apply one of its public licenses to material it publishes
|
||||
and in those instances will be considered the "Licensor." The text of the
|
||||
Creative Commons public licenses is dedicated to the public domain under the
|
||||
CC0 Public Domain Dedication. Except for the limited purpose of indicating
|
||||
that material is shared under a Creative Commons public license or as otherwise
|
||||
permitted by the Creative Commons policies published at creativecommons.org/policies,
|
||||
Creative Commons does not authorize the use of the trademark "Creative Commons"
|
||||
or any other trademark or logo of Creative Commons without its prior written
|
||||
consent including, without limitation, in connection with any unauthorized
|
||||
modifications to any of its public licenses or any other arrangements, understandings,
|
||||
or agreements concerning use of licensed material. For the avoidance of doubt,
|
||||
this paragraph does not form part of the public licenses.
|
||||
|
||||
Creative Commons may be contacted at creativecommons.org.
|
||||
19
LICENSES/MIT.txt
Normal file
19
LICENSES/MIT.txt
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
MIT License Copyright (c) <year> <copyright holders>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the next
|
||||
paragraph) shall be included in all copies or substantial portions of the
|
||||
Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
|
||||
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
20
LICENSES/Unlicense.txt
Normal file
20
LICENSES/Unlicense.txt
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
This is free and unencumbered software released into the public domain.
|
||||
|
||||
Anyone is free to copy, modify, publish, use, compile, sell, or distribute
|
||||
this software, either in source code form or as a compiled binary, for any
|
||||
purpose, commercial or non-commercial, and by any means.
|
||||
|
||||
In jurisdictions that recognize copyright laws, the author or authors of this
|
||||
software dedicate any and all copyright interest in the software to the public
|
||||
domain. We make this dedication for the benefit of the public at large and
|
||||
to the detriment of our heirs and successors. We intend this dedication to
|
||||
be an overt act of relinquishment in perpetuity of all present and future
|
||||
rights to this software under copyright law.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
|
||||
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. For more information,
|
||||
please refer to <https://unlicense.org/>
|
||||
33
README.rst
33
README.rst
|
|
@ -2,10 +2,10 @@ Introduction
|
|||
============
|
||||
|
||||
.. image:: https://readthedocs.org/projects/adafruit_circuitpython_led_animation/badge/?version=latest
|
||||
:target: https://circuitpython.readthedocs.io/projects/led-animation/en/latest/
|
||||
:target: https://docs.circuitpython.org/projects/led-animation/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
|
||||
|
||||
|
|
@ -13,6 +13,10 @@ Introduction
|
|||
:target: https://github.com/adafruit/Adafruit_CircuitPython_LED_Animation/actions
|
||||
:alt: Build Status
|
||||
|
||||
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
|
||||
:target: https://github.com/psf/black
|
||||
:alt: Code Style: Black
|
||||
|
||||
Perform a variety of LED animation tasks
|
||||
|
||||
Dependencies
|
||||
|
|
@ -46,8 +50,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-led-animation
|
||||
|
||||
Usage Example
|
||||
|
|
@ -57,7 +61,7 @@ Usage Example
|
|||
|
||||
import board
|
||||
import neopixel
|
||||
from adafruit_led_animation.animation import Blink
|
||||
from adafruit_led_animation.animation.blink import Blink
|
||||
import adafruit_led_animation.color as color
|
||||
|
||||
# Works on Circuit Playground Express and Bluefruit.
|
||||
|
|
@ -72,11 +76,18 @@ Usage Example
|
|||
while True:
|
||||
blink.animate()
|
||||
|
||||
Documentation
|
||||
=============
|
||||
|
||||
API documentation for this library can be found on `Read the Docs <https://docs.circuitpython.org/projects/led-animation/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
|
||||
============
|
||||
|
||||
Contributions are welcome! Please read our `Code of Conduct
|
||||
<https://github.com/apatt/CircuitPython_LED_Animation/blob/master/CODE_OF_CONDUCT.md>`_
|
||||
<https://github.com/apatt/CircuitPython_LED_Animation/blob/main/CODE_OF_CONDUCT.md>`_
|
||||
before contributing to help this project stay welcoming.
|
||||
|
||||
Building locally
|
||||
|
|
@ -90,15 +101,15 @@ To build this library locally you'll need to install the
|
|||
|
||||
.. code-block:: shell
|
||||
|
||||
python3 -m venv .env
|
||||
source .env/bin/activate
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
pip install circuitpython-build-tools
|
||||
|
||||
Once installed, make sure you are in the virtual environment:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
source .env/bin/activate
|
||||
source .venv/bin/activate
|
||||
|
||||
Then run the build:
|
||||
|
||||
|
|
@ -114,8 +125,8 @@ install dependencies (feel free to reuse the virtual environment from above):
|
|||
|
||||
.. code-block:: shell
|
||||
|
||||
python3 -m venv .env
|
||||
source .env/bin/activate
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
pip install Sphinx sphinx-rtd-theme
|
||||
|
||||
Now, once you have the virtual environment activated:
|
||||
|
|
|
|||
3
README.rst.license
Normal file
3
README.rst.license
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
|
||||
|
||||
SPDX-License-Identifier: MIT
|
||||
|
|
@ -1,24 +1,7 @@
|
|||
# The MIT License (MIT)
|
||||
# SPDX-FileCopyrightText: 2020 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# Copyright (c) 2020 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
"""
|
||||
Timing for Adafruit LED Animation library.
|
||||
|
||||
|
|
@ -44,7 +27,6 @@ try:
|
|||
"""
|
||||
return monotonic_ns() // NANOS_PER_MS
|
||||
|
||||
|
||||
except (ImportError, NotImplementedError):
|
||||
import time
|
||||
|
||||
|
|
|
|||
|
|
@ -1,24 +1,7 @@
|
|||
# The MIT License (MIT)
|
||||
# SPDX-FileCopyrightText: 2020 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# Copyright (c) 2020 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
"""
|
||||
`adafruit_led_animation.animation`
|
||||
================================================================================
|
||||
|
|
@ -42,7 +25,7 @@ Implementation Notes
|
|||
|
||||
"""
|
||||
|
||||
__version__ = "0.0.0-auto.0"
|
||||
__version__ = "0.0.0+auto.0"
|
||||
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_LED_Animation.git"
|
||||
|
||||
from adafruit_led_animation import MS_PER_SECOND, monotonic_ms
|
||||
|
|
|
|||
|
|
@ -1,24 +1,7 @@
|
|||
# The MIT License (MIT)
|
||||
# SPDX-FileCopyrightText: 2020 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# Copyright (c) 2020 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
"""
|
||||
`adafruit_led_animation.animation.blink`
|
||||
================================================================================
|
||||
|
|
|
|||
|
|
@ -1,24 +1,7 @@
|
|||
# The MIT License (MIT)
|
||||
# SPDX-FileCopyrightText: 2020 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# Copyright (c) 2020 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
"""
|
||||
`adafruit_led_animation.animation.chase`
|
||||
================================================================================
|
||||
|
|
@ -113,7 +96,7 @@ class Chase(Animation):
|
|||
bar_no += 1
|
||||
|
||||
colorgen = bar_colors()
|
||||
self.pixel_object[:] = [next(colorgen) for _ in self.pixel_object]
|
||||
self.pixel_object[:] = [next(colorgen) for _ in range(len(self.pixel_object))]
|
||||
|
||||
if self.draw_count % len(self.pixel_object) == 0:
|
||||
self.cycle_complete = True
|
||||
|
|
@ -128,7 +111,8 @@ class Chase(Animation):
|
|||
"""
|
||||
return self.color
|
||||
|
||||
def space_color(self, n, pixel_no=0): # pylint: disable=unused-argument,no-self-use
|
||||
@staticmethod
|
||||
def space_color(n, pixel_no=0): # pylint: disable=unused-argument
|
||||
"""
|
||||
Generate the spacing color for the n'th bar_color in the Chase
|
||||
|
||||
|
|
|
|||
|
|
@ -1,24 +1,7 @@
|
|||
# The MIT License (MIT)
|
||||
# SPDX-FileCopyrightText: 2020 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# Copyright (c) 2020 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
"""
|
||||
`adafruit_led_animation.animation.colorcycle`
|
||||
================================================================================
|
||||
|
|
|
|||
|
|
@ -1,24 +1,7 @@
|
|||
# The MIT License (MIT)
|
||||
# SPDX-FileCopyrightText: 2020 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# Copyright (c) 2020 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
"""
|
||||
`adafruit_led_animation.animation.comet`
|
||||
================================================================================
|
||||
|
|
@ -54,11 +37,15 @@ class Comet(Animation):
|
|||
:param pixel_object: The initialised LED object.
|
||||
:param float speed: Animation speed in seconds, e.g. ``0.1``.
|
||||
:param color: Animation color in ``(r, g, b)`` tuple, or ``0x000000`` hex format.
|
||||
:param background_color: Background color in ``(r, g, b)`` tuple, or ``0x000000`` hex format.
|
||||
Defaults to BLACK.
|
||||
:param int tail_length: The length of the comet. Defaults to 25% of the length of the
|
||||
``pixel_object``. Automatically compensates for a minimum of 2 and a
|
||||
maximum of the length of the ``pixel_object``.
|
||||
:param bool reverse: Animates the comet in the reverse order. Defaults to ``False``.
|
||||
:param bool bounce: Comet will bounce back and forth. Defaults to ``True``.
|
||||
:param bool bounce: Comet will bounce back and forth. Defaults to ``False``.
|
||||
:param Optional[string] name: A human-readable name for the Animation.
|
||||
Used by the to string function.
|
||||
:param bool ring: Ring mode. Defaults to ``False``.
|
||||
"""
|
||||
|
||||
|
|
@ -68,6 +55,7 @@ class Comet(Animation):
|
|||
pixel_object,
|
||||
speed,
|
||||
color,
|
||||
background_color=BLACK,
|
||||
tail_length=0,
|
||||
reverse=False,
|
||||
bounce=False,
|
||||
|
|
@ -78,13 +66,14 @@ class Comet(Animation):
|
|||
tail_length = len(pixel_object) // 4
|
||||
if bounce and ring:
|
||||
raise ValueError("Cannot combine bounce and ring mode")
|
||||
self.reverse = reverse
|
||||
self.bounce = bounce
|
||||
self._reverse = reverse
|
||||
self._initial_reverse = reverse
|
||||
self._tail_length = tail_length
|
||||
self._color_step = 0.95 / tail_length
|
||||
self._comet_colors = None
|
||||
self._computed_color = color
|
||||
self._background_color = background_color
|
||||
self._num_pixels = len(pixel_object)
|
||||
self._direction = -1 if reverse else 1
|
||||
self._left_side = -self._tail_length
|
||||
|
|
@ -99,44 +88,81 @@ class Comet(Animation):
|
|||
on_cycle_complete_supported = True
|
||||
|
||||
def _set_color(self, color):
|
||||
self._comet_colors = [BLACK]
|
||||
self._comet_colors = [self._background_color]
|
||||
for n in range(self._tail_length):
|
||||
self._comet_colors.append(
|
||||
calculate_intensity(color, n * self._color_step + 0.05)
|
||||
)
|
||||
self._computed_color = color
|
||||
|
||||
@property
|
||||
def reverse(self):
|
||||
"""
|
||||
Whether the animation is reversed
|
||||
"""
|
||||
return self._reverse
|
||||
|
||||
@reverse.setter
|
||||
def reverse(self, value):
|
||||
self._reverse = value
|
||||
self._direction = -1 if self._reverse else 1
|
||||
|
||||
@property
|
||||
def ring(self):
|
||||
"""
|
||||
Ring mode.
|
||||
"""
|
||||
return self._ring
|
||||
|
||||
@ring.setter
|
||||
def ring(self, value):
|
||||
if self.bounce and value:
|
||||
raise ValueError("Cannot combine bounce and ring mode")
|
||||
self._ring = value
|
||||
self._left_side = 0 if value else -self._tail_length
|
||||
self.reset()
|
||||
|
||||
def draw(self):
|
||||
colors = self._comet_colors
|
||||
if self.reverse:
|
||||
colors = reversed(colors)
|
||||
for pixel_no, color in enumerate(colors):
|
||||
draw_at = self._tail_start + pixel_no
|
||||
if draw_at < 0 or draw_at >= self._num_pixels:
|
||||
if not self._ring:
|
||||
continue
|
||||
draw_at = draw_at % self._num_pixels
|
||||
|
||||
self.pixel_object[draw_at] = color
|
||||
pixels = self.pixel_object
|
||||
start = self._tail_start
|
||||
npixels = len(pixels)
|
||||
if self._ring:
|
||||
start %= npixels
|
||||
for color in colors:
|
||||
pixels[start] = color
|
||||
start += 1
|
||||
if start == npixels:
|
||||
start = 0
|
||||
else:
|
||||
for color in colors:
|
||||
if start >= npixels:
|
||||
break
|
||||
if start >= 0:
|
||||
pixels[start] = color
|
||||
start += 1
|
||||
|
||||
self._tail_start += self._direction
|
||||
|
||||
if self._tail_start < self._left_side or self._tail_start >= self._right_side:
|
||||
if self._tail_start < self._left_side or (
|
||||
self._tail_start >= self._right_side and not self._reverse
|
||||
):
|
||||
if self.bounce:
|
||||
self.reverse = not self.reverse
|
||||
self._direction = -self._direction
|
||||
elif self._ring:
|
||||
self._tail_start = self._tail_start % self._num_pixels
|
||||
else:
|
||||
self.reset()
|
||||
if self.reverse == self._initial_reverse and self.draw_count > 0:
|
||||
self.cycle_complete = True
|
||||
|
||||
self.cycle_complete = True
|
||||
|
||||
def reset(self):
|
||||
"""
|
||||
Resets to the first state.
|
||||
"""
|
||||
self.reverse = self._initial_reverse
|
||||
if self.reverse:
|
||||
self._tail_start = self._num_pixels + self._tail_length + 1
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -1,25 +1,8 @@
|
|||
# The MIT License (MIT)
|
||||
# SPDX-FileCopyrightText: 2020 Kattni Rembor for Adafruit Industries
|
||||
# SPDX-FileCopyrightText: 2020 Connie Sieh for Adafruit Industries
|
||||
#
|
||||
# Copyright (c) 2020 Kattni Rembor for Adafruit Industries
|
||||
# Copyright (c) 2020 Connie Sieh
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
"""
|
||||
`adafruit_led_animation.animation.customcolorchase`
|
||||
================================================================================
|
||||
|
|
|
|||
|
|
@ -1,24 +1,7 @@
|
|||
# The MIT License (MIT)
|
||||
# SPDX-FileCopyrightText: 2020 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# Copyright (c) 2020 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
"""
|
||||
`adafruit_led_animation.animation.grid_rain`
|
||||
================================================================================
|
||||
|
|
@ -45,7 +28,7 @@ Implementation Notes
|
|||
import random
|
||||
from adafruit_led_animation.animation import Animation
|
||||
|
||||
__version__ = "0.0.0-auto.0"
|
||||
__version__ = "0.0.0+auto.0"
|
||||
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_LED_Animation.git"
|
||||
|
||||
from adafruit_led_animation.color import BLACK, colorwheel, calculate_intensity, GREEN
|
||||
|
|
@ -74,7 +57,6 @@ class Rain(Animation):
|
|||
super().__init__(grid_object, speed, color, name=name)
|
||||
|
||||
def draw(self):
|
||||
|
||||
# Move raindrops down
|
||||
keep = []
|
||||
for raindrop in self._raindrops:
|
||||
|
|
|
|||
114
adafruit_led_animation/animation/multicolor_comet.py
Normal file
114
adafruit_led_animation/animation/multicolor_comet.py
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
# SPDX-FileCopyrightText: 2022 Tim Cocks
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
"""
|
||||
`adafruit_led_animation.animation.multicolor_comet`
|
||||
================================================================================
|
||||
|
||||
Multi-color Comet animation for CircuitPython helper library for LED animations.
|
||||
|
||||
* Author(s): Kattni Rembor, Tim Cocks
|
||||
|
||||
Implementation Notes
|
||||
--------------------
|
||||
|
||||
**Hardware:**
|
||||
|
||||
* `Adafruit NeoPixels <https://www.adafruit.com/category/168>`_
|
||||
* `Adafruit DotStars <https://www.adafruit.com/category/885>`_
|
||||
|
||||
**Software and Dependencies:**
|
||||
|
||||
* Adafruit CircuitPython firmware for the supported boards:
|
||||
https://circuitpython.org/downloads
|
||||
|
||||
|
||||
"""
|
||||
from adafruit_led_animation.animation.comet import Comet
|
||||
from adafruit_led_animation.color import BLACK
|
||||
|
||||
|
||||
class MulticolorComet(Comet):
|
||||
"""
|
||||
A multi-color comet animation.
|
||||
|
||||
:param pixel_object: The initialised LED object.
|
||||
:param float speed: Animation speed in seconds, e.g. ``0.1``.
|
||||
:param colors: Animation colors in a list or tuple of entries in
|
||||
``(r, g, b)`` tuple, or ``0x000000`` hex format.
|
||||
:param int tail_length: The length of the comet. Defaults to 25% of the length of the
|
||||
``pixel_object``. Automatically compensates for a minimum of 2 and a
|
||||
maximum of the length of the ``pixel_object``.
|
||||
:param bool reverse: Animates the comet in the reverse order. Defaults to ``False``.
|
||||
:param bool bounce: Comet will bounce back and forth. Defaults to ``True``.
|
||||
:param Optional[string] name: A human-readable name for the Animation.
|
||||
Used by the to string function.
|
||||
:param bool ring: Ring mode. Defaults to ``False``.
|
||||
:param bool off_pixels: Turn pixels off after the animation passes them. Defaults to ``True``.
|
||||
Setting to False will result in all pixels not currently in the comet
|
||||
to remain on and set to a color after the comet passes.
|
||||
"""
|
||||
|
||||
# pylint: disable=too-many-arguments,too-many-instance-attributes
|
||||
def __init__(
|
||||
self,
|
||||
pixel_object,
|
||||
speed,
|
||||
colors,
|
||||
*,
|
||||
tail_length=0,
|
||||
reverse=False,
|
||||
bounce=False,
|
||||
name=None,
|
||||
ring=False,
|
||||
off_pixels=True,
|
||||
):
|
||||
if tail_length == 0:
|
||||
tail_length = len(pixel_object) // 4
|
||||
if bounce and ring:
|
||||
raise ValueError("Cannot combine bounce and ring mode")
|
||||
self.bounce = bounce
|
||||
self._reverse = reverse
|
||||
self._initial_reverse = reverse
|
||||
self._tail_length = tail_length
|
||||
|
||||
self._comet_colors = None
|
||||
|
||||
self._num_pixels = len(pixel_object)
|
||||
self._direction = -1 if reverse else 1
|
||||
self._left_side = -self._tail_length
|
||||
self._right_side = self._num_pixels
|
||||
self._tail_start = 0
|
||||
self._ring = ring
|
||||
self._colors = colors
|
||||
if colors is None or len(colors) < 2:
|
||||
raise ValueError("Must pass at least two colors.")
|
||||
|
||||
self._off_pixels = off_pixels
|
||||
if ring:
|
||||
self._left_side = 0
|
||||
self.reset()
|
||||
super().__init__(
|
||||
pixel_object,
|
||||
speed,
|
||||
0x0,
|
||||
name=name,
|
||||
tail_length=tail_length,
|
||||
bounce=bounce,
|
||||
ring=ring,
|
||||
reverse=reverse,
|
||||
)
|
||||
|
||||
on_cycle_complete_supported = True
|
||||
|
||||
def _set_color(self, color):
|
||||
if self._off_pixels:
|
||||
self._comet_colors = [BLACK]
|
||||
else:
|
||||
self._comet_colors = []
|
||||
|
||||
for n in range(self._tail_length):
|
||||
_float_index = ((len(self._colors)) / self._tail_length) * n
|
||||
_color_index = int(_float_index)
|
||||
self._comet_colors.append(self._colors[_color_index])
|
||||
|
|
@ -1,24 +1,7 @@
|
|||
# The MIT License (MIT)
|
||||
# SPDX-FileCopyrightText: 2020 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# Copyright (c) 2020 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
"""
|
||||
`adafruit_led_animation.animation.pulse`
|
||||
================================================================================
|
||||
|
|
|
|||
|
|
@ -1,24 +1,7 @@
|
|||
# The MIT License (MIT)
|
||||
# SPDX-FileCopyrightText: 2020 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# Copyright (c) 2020 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
"""
|
||||
`adafruit_led_animation.animation.rainbow`
|
||||
================================================================================
|
||||
|
|
@ -46,7 +29,7 @@ from adafruit_led_animation.animation import Animation
|
|||
from adafruit_led_animation.color import BLACK, colorwheel
|
||||
from adafruit_led_animation import MS_PER_SECOND, monotonic_ms
|
||||
|
||||
__version__ = "0.0.0-auto.0"
|
||||
__version__ = "0.0.0+auto.0"
|
||||
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_LED_Animation.git"
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,24 +1,7 @@
|
|||
# The MIT License (MIT)
|
||||
# SPDX-FileCopyrightText: 2020 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# Copyright (c) 2020 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
"""
|
||||
`adafruit_led_animation.animation.rainbowchase`
|
||||
================================================================================
|
||||
|
|
@ -57,12 +40,19 @@ class RainbowChase(Chase):
|
|||
:param size: Number of pixels to turn on in a row.
|
||||
:param spacing: Number of pixels to turn off in a row.
|
||||
:param reverse: Reverse direction of movement.
|
||||
:param step: How many colors to skip in `colorwheel` per bar (default 8)
|
||||
:param step: How many colors to skip in ``colorwheel`` per bar (default 8)
|
||||
"""
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
def __init__(
|
||||
self, pixel_object, speed, size=2, spacing=3, reverse=False, name=None, step=8,
|
||||
self,
|
||||
pixel_object,
|
||||
speed,
|
||||
size=2,
|
||||
spacing=3,
|
||||
reverse=False,
|
||||
name=None,
|
||||
step=8,
|
||||
):
|
||||
self._num_colors = 256 // step
|
||||
self._colors = [colorwheel(n % 256) for n in range(0, 512, step)]
|
||||
|
|
|
|||
|
|
@ -1,24 +1,7 @@
|
|||
# The MIT License (MIT)
|
||||
# SPDX-FileCopyrightText: 2020 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# Copyright (c) 2020 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
"""
|
||||
`adafruit_led_animation.animation.rainbowcomet`
|
||||
================================================================================
|
||||
|
|
@ -57,7 +40,7 @@ class RainbowComet(Comet):
|
|||
pixels present in the pixel object, e.g. if the strip is 30 pixels
|
||||
long, the ``tail_length`` cannot exceed 30 pixels.
|
||||
:param bool reverse: Animates the comet in the reverse order. Defaults to ``False``.
|
||||
:param bool bounce: Comet will bounce back and forth. Defaults to ``True``.
|
||||
:param bool bounce: Comet will bounce back and forth. Defaults to ``False``.
|
||||
:param int colorwheel_offset: Offset from start of colorwheel (0-255).
|
||||
:param int step: Colorwheel step (defaults to automatic).
|
||||
:param bool ring: Ring mode. Defaults to ``False``.
|
||||
|
|
@ -82,7 +65,7 @@ class RainbowComet(Comet):
|
|||
self._colorwheel_step = step
|
||||
self._colorwheel_offset = colorwheel_offset
|
||||
super().__init__(
|
||||
pixel_object, speed, 0, tail_length, reverse, bounce, name, ring
|
||||
pixel_object, speed, 0, 0, tail_length, reverse, bounce, name, ring
|
||||
)
|
||||
|
||||
def _set_color(self, color):
|
||||
|
|
|
|||
|
|
@ -1,24 +1,7 @@
|
|||
# The MIT License (MIT)
|
||||
# SPDX-FileCopyrightText: 2020 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# Copyright (c) 2020 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
"""
|
||||
`adafruit_led_animation.animation.rainbowsparkle`
|
||||
================================================================================
|
||||
|
|
|
|||
|
|
@ -1,24 +1,7 @@
|
|||
# The MIT License (MIT)
|
||||
# SPDX-FileCopyrightText: 2020 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# Copyright (c) 2020 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
"""
|
||||
`adafruit_led_animation.animation.solid`
|
||||
================================================================================
|
||||
|
|
|
|||
|
|
@ -1,24 +1,7 @@
|
|||
# The MIT License (MIT)
|
||||
# SPDX-FileCopyrightText: 2020 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# Copyright (c) 2020 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
"""
|
||||
`adafruit_led_animation.animation.sparkle`
|
||||
================================================================================
|
||||
|
|
@ -45,7 +28,7 @@ Implementation Notes
|
|||
import random
|
||||
from adafruit_led_animation.animation import Animation
|
||||
|
||||
__version__ = "0.0.0-auto.0"
|
||||
__version__ = "0.0.0+auto.0"
|
||||
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_LED_Animation.git"
|
||||
|
||||
|
||||
|
|
@ -57,12 +40,21 @@ class Sparkle(Animation):
|
|||
:param float speed: Animation speed in seconds, e.g. ``0.1``.
|
||||
:param color: Animation color in ``(r, g, b)`` tuple, or ``0x000000`` hex format.
|
||||
:param num_sparkles: Number of sparkles to generate per animation cycle.
|
||||
:param mask: array to limit sparkles within range of the mask
|
||||
"""
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
def __init__(self, pixel_object, speed, color, num_sparkles=1, name=None):
|
||||
def __init__(
|
||||
self, pixel_object, speed, color, num_sparkles=1, name=None, mask=None
|
||||
):
|
||||
if len(pixel_object) < 2:
|
||||
raise ValueError("Sparkle needs at least 2 pixels")
|
||||
if mask:
|
||||
self._mask = mask
|
||||
else:
|
||||
self._mask = []
|
||||
if len(self._mask) >= len(pixel_object):
|
||||
raise ValueError("Sparkle mask should be smaller than number pixel array")
|
||||
self._half_color = color
|
||||
self._dim_color = color
|
||||
self._sparkle_color = color
|
||||
|
|
@ -74,7 +66,9 @@ class Sparkle(Animation):
|
|||
def _set_color(self, color):
|
||||
half_color = tuple(color[rgb] // 4 for rgb in range(len(color)))
|
||||
dim_color = tuple(color[rgb] // 10 for rgb in range(len(color)))
|
||||
for pixel in range(len(self.pixel_object)):
|
||||
for pixel in range( # pylint: disable=consider-using-enumerate
|
||||
len(self.pixel_object)
|
||||
):
|
||||
if self.pixel_object[pixel] == self._half_color:
|
||||
self.pixel_object[pixel] = half_color
|
||||
elif self.pixel_object[pixel] == self._dim_color:
|
||||
|
|
@ -83,11 +77,13 @@ class Sparkle(Animation):
|
|||
self._dim_color = dim_color
|
||||
self._sparkle_color = color
|
||||
|
||||
def _random_in_mask(self):
|
||||
if len(self._mask) == 0:
|
||||
return random.randint(0, (len(self.pixel_object) - 1))
|
||||
return self._mask[random.randint(0, (len(self._mask) - 1))]
|
||||
|
||||
def draw(self):
|
||||
self._pixels = [
|
||||
random.randint(0, (len(self.pixel_object) - 1))
|
||||
for _ in range(self._num_sparkles)
|
||||
]
|
||||
self._pixels = [self._random_in_mask() for _ in range(self._num_sparkles)]
|
||||
for pixel in self._pixels:
|
||||
self.pixel_object[pixel] = self._sparkle_color
|
||||
|
||||
|
|
@ -95,4 +91,5 @@ class Sparkle(Animation):
|
|||
self.show()
|
||||
for pixel in self._pixels:
|
||||
self.pixel_object[pixel % self._num_pixels] = self._half_color
|
||||
self.pixel_object[(pixel + 1) % self._num_pixels] = self._dim_color
|
||||
if (pixel + 1) % self._num_pixels in self._mask:
|
||||
self.pixel_object[(pixel + 1) % self._num_pixels] = self._dim_color
|
||||
|
|
|
|||
|
|
@ -1,24 +1,7 @@
|
|||
# The MIT License (MIT)
|
||||
# SPDX-FileCopyrightText: 2020 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# Copyright (c) 2020 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
"""
|
||||
`adafruit_led_animation.animation.sparklepulse`
|
||||
================================================================================
|
||||
|
|
|
|||
|
|
@ -1,76 +1,77 @@
|
|||
# The MIT License (MIT)
|
||||
# SPDX-FileCopyrightText: 2019 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# Copyright (c) 2019 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
"""Color variables made available for import for CircuitPython LED animations library.
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
RGBW_WHITE_RGB is for RGBW strips to illuminate only the RGB diodes.
|
||||
RGBW_WHITE_W is for RGBW strips to illuminate only White diode.
|
||||
RGBW_WHITE_RGBW is for RGBW strips to illuminate the RGB and White diodes.
|
||||
|
||||
RAINBOW is a list of colors to use for cycling through.
|
||||
"""
|
||||
`adafruit_led_animation.color`
|
||||
================================================================================
|
||||
|
||||
Color variables assigned to RGB values made available for import.
|
||||
|
||||
* Author(s): Kattni Rembor
|
||||
|
||||
Implementation Notes
|
||||
--------------------
|
||||
|
||||
**Hardware:**
|
||||
|
||||
* `Adafruit NeoPixels <https://www.adafruit.com/category/168>`_
|
||||
* `Adafruit DotStars <https://www.adafruit.com/category/885>`_
|
||||
|
||||
**Software and Dependencies:**
|
||||
|
||||
* Adafruit CircuitPython firmware for the supported boards:
|
||||
https://circuitpython.org/downloads
|
||||
"""
|
||||
# Makes colorwheel() available.
|
||||
from rainbowio import colorwheel # pylint: disable=unused-import
|
||||
|
||||
RED = (255, 0, 0)
|
||||
"""Red."""
|
||||
YELLOW = (255, 150, 0)
|
||||
"""Yellow."""
|
||||
ORANGE = (255, 40, 0)
|
||||
"""Orange."""
|
||||
GREEN = (0, 255, 0)
|
||||
"""Green."""
|
||||
TEAL = (0, 255, 120)
|
||||
"""Teal."""
|
||||
CYAN = (0, 255, 255)
|
||||
"""Cyan."""
|
||||
BLUE = (0, 0, 255)
|
||||
"""Blue."""
|
||||
PURPLE = (180, 0, 255)
|
||||
"""Purple."""
|
||||
MAGENTA = (255, 0, 20)
|
||||
"""Magenta."""
|
||||
WHITE = (255, 255, 255)
|
||||
"""White."""
|
||||
BLACK = (0, 0, 0)
|
||||
"""Black or off."""
|
||||
|
||||
GOLD = (255, 222, 30)
|
||||
"""Gold."""
|
||||
PINK = (242, 90, 255)
|
||||
"""Pink."""
|
||||
AQUA = (50, 255, 255)
|
||||
"""Aqua."""
|
||||
JADE = (0, 255, 40)
|
||||
"""Jade."""
|
||||
AMBER = (255, 100, 0)
|
||||
"""Amber."""
|
||||
OLD_LACE = (253, 245, 230) # Warm white.
|
||||
"""Old lace or warm white."""
|
||||
|
||||
RGBW_WHITE_RGB = (255, 255, 255, 0)
|
||||
"""RGBW_WHITE_RGB is for RGBW strips to illuminate only the RGB diodes."""
|
||||
RGBW_WHITE_W = (0, 0, 0, 255)
|
||||
"""RGBW_WHITE_W is for RGBW strips to illuminate only White diode."""
|
||||
RGBW_WHITE_RGBW = (255, 255, 255, 255)
|
||||
"""RGBW_WHITE_RGBW is for RGBW strips to illuminate the RGB and White diodes."""
|
||||
|
||||
RAINBOW = (RED, ORANGE, YELLOW, GREEN, BLUE, PURPLE)
|
||||
|
||||
try:
|
||||
try:
|
||||
# Backwards compat for 5.3.0 and prior
|
||||
from _pixelbuf import colorwheel # pylint: disable=unused-import
|
||||
except ImportError:
|
||||
from _pixelbuf import wheel as colorwheel # pylint: disable=unused-import
|
||||
except ImportError:
|
||||
# Ensure we have a wheel if not built in
|
||||
def colorwheel(pos):
|
||||
"""Input a value 0 to 255 to get a color value.
|
||||
The colours are a transition r - g - b - back to r."""
|
||||
if pos < 0 or pos > 255:
|
||||
return 0, 0, 0
|
||||
if pos < 85:
|
||||
return int(255 - pos * 3), int(pos * 3), 0
|
||||
if pos < 170:
|
||||
pos -= 85
|
||||
return 0, int(255 - pos * 3), int(pos * 3)
|
||||
pos -= 170
|
||||
return int(pos * 3), 0, int(255 - (pos * 3))
|
||||
"""RAINBOW is a list of colors to use for cycling through.
|
||||
Includes, in order: red, orange, yellow, green, blue, and purple."""
|
||||
|
||||
|
||||
def calculate_intensity(color, intensity=1.0):
|
||||
|
|
|
|||
|
|
@ -1,24 +1,7 @@
|
|||
# The MIT License (MIT)
|
||||
# SPDX-FileCopyrightText: 2020 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# Copyright (c) 2020 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
"""
|
||||
`adafruit_led_animation.grid`
|
||||
================================================================================
|
||||
|
|
|
|||
|
|
@ -1,24 +1,7 @@
|
|||
# The MIT License (MIT)
|
||||
# SPDX-FileCopyrightText: 2020 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# Copyright (c) 2020 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
"""
|
||||
`adafruit_led_animation.group`
|
||||
================================================================================
|
||||
|
|
@ -43,7 +26,7 @@ Implementation Notes
|
|||
|
||||
"""
|
||||
|
||||
__version__ = "0.0.0-auto.0"
|
||||
__version__ = "0.0.0+auto.0"
|
||||
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_LED_Animation.git"
|
||||
|
||||
from adafruit_led_animation.animation import Animation
|
||||
|
|
@ -61,7 +44,7 @@ class AnimationGroup:
|
|||
|
||||
Example:
|
||||
|
||||
.. code-block::
|
||||
.. code-block:: python
|
||||
|
||||
import board
|
||||
import neopixel
|
||||
|
|
@ -169,7 +152,11 @@ class AnimationGroup:
|
|||
member.show()
|
||||
return result
|
||||
|
||||
return any([item.animate(show) for item in self._members])
|
||||
ret = False
|
||||
for item in self._members:
|
||||
if item.animate(show):
|
||||
ret = True
|
||||
return ret
|
||||
|
||||
@property
|
||||
def color(self):
|
||||
|
|
|
|||
|
|
@ -1,24 +1,7 @@
|
|||
# The MIT License (MIT)
|
||||
# SPDX-FileCopyrightText: 2019 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# Copyright (c) 2019
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
"""
|
||||
`adafruit_led_animation.helper`
|
||||
================================================================================
|
||||
|
|
|
|||
|
|
@ -1,24 +1,7 @@
|
|||
# The MIT License (MIT)
|
||||
# SPDX-FileCopyrightText: 2020 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# Copyright (c) 2020 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
"""
|
||||
`adafruit_led_animation.sequence`
|
||||
================================================================================
|
||||
|
|
@ -47,7 +30,7 @@ import random
|
|||
from adafruit_led_animation.color import BLACK
|
||||
from . import MS_PER_SECOND, monotonic_ms
|
||||
|
||||
__version__ = "0.0.0-auto.0"
|
||||
__version__ = "0.0.0+auto.0"
|
||||
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_LED_Animation.git"
|
||||
|
||||
|
||||
|
|
@ -196,6 +179,13 @@ class AnimationSequence:
|
|||
self.on_cycle_complete()
|
||||
self.activate(current % len(self._members))
|
||||
|
||||
def previous(self):
|
||||
"""
|
||||
Jump to the previous animation.
|
||||
"""
|
||||
current = self._current - 1
|
||||
self.activate(current % len(self._members))
|
||||
|
||||
def random(self):
|
||||
"""
|
||||
Jump to a random animation.
|
||||
|
|
|
|||
3
docs/_static/favicon.ico.license
vendored
Normal file
3
docs/_static/favicon.ico.license
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
SPDX-FileCopyrightText: 2018 Phillip Torrone for Adafruit Industries
|
||||
|
||||
SPDX-License-Identifier: CC-BY-4.0
|
||||
3
docs/api.rst.license
Normal file
3
docs/api.rst.license
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# SPDX-FileCopyrightText: 2020 ladyada for Adafruit Industries
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
23
docs/conf.py
23
docs/conf.py
|
|
@ -1,7 +1,12 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
import os
|
||||
import sys
|
||||
import datetime
|
||||
|
||||
sys.path.insert(0, os.path.abspath(".."))
|
||||
|
||||
|
|
@ -12,6 +17,7 @@ sys.path.insert(0, os.path.abspath(".."))
|
|||
# ones.
|
||||
extensions = [
|
||||
"sphinx.ext.autodoc",
|
||||
"sphinxcontrib.jquery",
|
||||
"sphinx.ext.intersphinx",
|
||||
"sphinx.ext.napoleon",
|
||||
"sphinx.ext.todo",
|
||||
|
|
@ -21,12 +27,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 = []
|
||||
autodoc_mock_imports = ["rainbowio"]
|
||||
|
||||
|
||||
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.
|
||||
|
|
@ -39,7 +45,14 @@ master_doc = "index"
|
|||
|
||||
# General information about the project.
|
||||
project = "LED_Animation Library"
|
||||
copyright = "2020 Kattni Rembor"
|
||||
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 + " Kattni Rembor"
|
||||
author = "Kattni Rembor"
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
|
|
@ -56,7 +69,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.
|
||||
|
|
|
|||
|
|
@ -6,3 +6,93 @@ Ensure your device works with this simple test.
|
|||
.. literalinclude:: ../examples/led_animation_simpletest.py
|
||||
:caption: examples/led_animation_simpletest.py
|
||||
:linenos:
|
||||
|
||||
Basic Animations
|
||||
----------------
|
||||
|
||||
Demonstrates the basic animations.
|
||||
|
||||
.. literalinclude:: ../examples/led_animation_basic_animations.py
|
||||
:caption: examples/led_animation_basic_animations.py
|
||||
:linenos:
|
||||
|
||||
All Animations
|
||||
----------------
|
||||
|
||||
Demonstrates the entire suite of animations.
|
||||
|
||||
.. literalinclude:: ../examples/led_animation_all_animations.py
|
||||
:caption: examples/led_animation_all_animations.py
|
||||
:linenos:
|
||||
|
||||
Pixel Map
|
||||
---------
|
||||
|
||||
Demonstrates the pixel mapping feature.
|
||||
|
||||
.. literalinclude:: ../examples/led_animation_pixel_map.py
|
||||
:caption: examples/led_animation_pixel_map.py
|
||||
:linenos:
|
||||
|
||||
Animation Sequence
|
||||
------------------
|
||||
|
||||
Demonstrates the animation sequence feature.
|
||||
|
||||
.. literalinclude:: ../examples/led_animation_sequence.py
|
||||
:caption: examples/led_animation_sequence.py
|
||||
:linenos:
|
||||
|
||||
Animation Group
|
||||
---------------
|
||||
|
||||
Demonstrates the animation group feature.
|
||||
|
||||
.. literalinclude:: ../examples/led_animation_group.py
|
||||
:caption: examples/led_animation_group.py
|
||||
:linenos:
|
||||
|
||||
Blink
|
||||
-----
|
||||
|
||||
Demonstrates the blink animation.
|
||||
|
||||
.. literalinclude:: ../examples/led_animation_blink.py
|
||||
:caption: examples/led_animation_blink.py
|
||||
:linenos:
|
||||
|
||||
Comet
|
||||
-----
|
||||
|
||||
Demonstrates the comet animation.
|
||||
|
||||
.. literalinclude:: ../examples/led_animation_comet.py
|
||||
:caption: examples/led_animation_comet.py
|
||||
:linenos:
|
||||
|
||||
Chase
|
||||
-----
|
||||
|
||||
Demonstrates the chase animation.
|
||||
|
||||
.. literalinclude:: ../examples/led_animation_chase.py
|
||||
:caption: examples/led_animation_chase.py
|
||||
:linenos:
|
||||
|
||||
Rainbow
|
||||
-------
|
||||
|
||||
Demonstrates the rainbow animations.
|
||||
|
||||
.. literalinclude:: ../examples/led_animation_rainbow_animations.py
|
||||
:caption: examples/led_animation_rainbow_animations.py
|
||||
:linenos:
|
||||
|
||||
Sparkle
|
||||
-------
|
||||
|
||||
Demonstrates the sparkle animations.
|
||||
|
||||
.. literalinclude:: ../examples/led_animation_sparkle_animations.py
|
||||
:caption: examples/led_animation_sparkle_animations.py
|
||||
:linenos:
|
||||
|
|
|
|||
3
docs/examples.rst.license
Normal file
3
docs/examples.rst.license
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# SPDX-FileCopyrightText: 2020 ladyada for Adafruit Industries
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
|
@ -20,11 +20,25 @@ Table of Contents
|
|||
|
||||
api
|
||||
|
||||
|
||||
.. toctree::
|
||||
:caption: Tutorials
|
||||
|
||||
CircuitPython LED Animations Learning Guide <https://learn.adafruit.com/circuitpython-led-animations>
|
||||
|
||||
.. toctree::
|
||||
:caption: Related Products
|
||||
|
||||
Adafruit NeoPixel LEDs <https://www.adafruit.com/category/168>
|
||||
|
||||
Adafruit DotStar LEDs <https://www.adafruit.com/category/885>
|
||||
|
||||
.. toctree::
|
||||
:caption: Other Links
|
||||
|
||||
Download <https://github.com/adafruit/Adafruit_CircuitPython_LED_Animation/releases/latest>
|
||||
CircuitPython Reference Documentation <https://circuitpython.readthedocs.io>
|
||||
Download from GitHub <https://github.com/adafruit/Adafruit_CircuitPython_LED_Animation/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>
|
||||
|
|
|
|||
3
docs/index.rst.license
Normal file
3
docs/index.rst.license
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# SPDX-FileCopyrightText: 2020 ladyada for Adafruit Industries
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
6
docs/requirements.txt
Normal file
6
docs/requirements.txt
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
|
||||
#
|
||||
# SPDX-License-Identifier: Unlicense
|
||||
|
||||
sphinx>=4.0.0
|
||||
sphinxcontrib-jquery
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
"""
|
||||
This example repeatedly displays all available animations, at a five second interval.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
"""
|
||||
This example displays the basic animations in sequence, at a five second interval.
|
||||
|
||||
|
|
@ -43,7 +46,14 @@ pulse = Pulse(pixels, speed=0.1, color=AMBER, period=3)
|
|||
|
||||
|
||||
animations = AnimationSequence(
|
||||
solid, blink, colorcycle, chase, comet, pulse, advance_interval=5, auto_clear=True,
|
||||
solid,
|
||||
blink,
|
||||
colorcycle,
|
||||
chase,
|
||||
comet,
|
||||
pulse,
|
||||
advance_interval=5,
|
||||
auto_clear=True,
|
||||
)
|
||||
|
||||
while True:
|
||||
|
|
|
|||
29
examples/led_animation_blink.py
Executable file
29
examples/led_animation_blink.py
Executable file
|
|
@ -0,0 +1,29 @@
|
|||
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
"""
|
||||
This example blinks the LEDs purple at a 0.5 second interval.
|
||||
|
||||
For QT Py Haxpress and a NeoPixel strip. Update pixel_pin and pixel_num to match your wiring if
|
||||
using a different board or form of NeoPixels.
|
||||
|
||||
This example will run on SAMD21 (M0) Express boards (such as Circuit Playground Express or QT Py
|
||||
Haxpress), but not on SAMD21 non-Express boards (such as QT Py or Trinket).
|
||||
"""
|
||||
import board
|
||||
import neopixel
|
||||
|
||||
from adafruit_led_animation.animation.blink import Blink
|
||||
from adafruit_led_animation.color import PURPLE
|
||||
|
||||
# Update to match the pin connected to your NeoPixels
|
||||
pixel_pin = board.A3
|
||||
# Update to match the number of NeoPixels you have connected
|
||||
pixel_num = 30
|
||||
|
||||
pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=0.5, auto_write=False)
|
||||
|
||||
blink = Blink(pixels, speed=0.5, color=PURPLE)
|
||||
|
||||
while True:
|
||||
blink.animate()
|
||||
30
examples/led_animation_chase.py
Executable file
30
examples/led_animation_chase.py
Executable file
|
|
@ -0,0 +1,30 @@
|
|||
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
"""
|
||||
This example animates a theatre chase style animation in white with a repeated 3 LEDs lit up at a
|
||||
spacing of six LEDs off.
|
||||
|
||||
For QT Py Haxpress and a NeoPixel strip. Update pixel_pin and pixel_num to match your wiring if
|
||||
using a different board or form of NeoPixels.
|
||||
|
||||
This example will run on SAMD21 (M0) Express boards (such as Circuit Playground Express or QT Py
|
||||
Haxpress), but not on SAMD21 non-Express boards (such as QT Py or Trinket).
|
||||
"""
|
||||
import board
|
||||
import neopixel
|
||||
|
||||
from adafruit_led_animation.animation.chase import Chase
|
||||
from adafruit_led_animation.color import WHITE
|
||||
|
||||
# Update to match the pin connected to your NeoPixels
|
||||
pixel_pin = board.A3
|
||||
# Update to match the number of NeoPixels you have connected
|
||||
pixel_num = 30
|
||||
|
||||
pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=0.5, auto_write=False)
|
||||
|
||||
chase = Chase(pixels, speed=0.1, size=3, spacing=6, color=WHITE)
|
||||
|
||||
while True:
|
||||
chase.animate()
|
||||
29
examples/led_animation_comet.py
Executable file
29
examples/led_animation_comet.py
Executable file
|
|
@ -0,0 +1,29 @@
|
|||
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
"""
|
||||
This example animates a jade comet that bounces from end to end of the strip.
|
||||
|
||||
For QT Py Haxpress and a NeoPixel strip. Update pixel_pin and pixel_num to match your wiring if
|
||||
using a different board or form of NeoPixels.
|
||||
|
||||
This example will run on SAMD21 (M0) Express boards (such as Circuit Playground Express or QT Py
|
||||
Haxpress), but not on SAMD21 non-Express boards (such as QT Py or Trinket).
|
||||
"""
|
||||
import board
|
||||
import neopixel
|
||||
|
||||
from adafruit_led_animation.animation.comet import Comet
|
||||
from adafruit_led_animation.color import JADE
|
||||
|
||||
# Update to match the pin connected to your NeoPixels
|
||||
pixel_pin = board.A3
|
||||
# Update to match the number of NeoPixels you have connected
|
||||
pixel_num = 30
|
||||
|
||||
pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=0.5, auto_write=False)
|
||||
|
||||
comet = Comet(pixels, speed=0.02, color=JADE, tail_length=10, bounce=True)
|
||||
|
||||
while True:
|
||||
comet.animate()
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
"""
|
||||
This example displays custom color chase animations in sequence, at a six second interval.
|
||||
|
||||
|
|
|
|||
44
examples/led_animation_cycle_animations.py
Normal file
44
examples/led_animation_cycle_animations.py
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
# SPDX-FileCopyrightText: 2021 Alec Delaney
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
"""
|
||||
This example uses AnimationsSequence along with a connected push button to cycle through
|
||||
two animations
|
||||
|
||||
For NeoPixel FeatherWing. Update pixel_pin and pixel_num to match your wiring if using
|
||||
a different form of NeoPixels.
|
||||
"""
|
||||
import time
|
||||
import board
|
||||
import neopixel
|
||||
from digitalio import DigitalInOut, Direction, Pull
|
||||
|
||||
from adafruit_led_animation.animation.solid import Solid
|
||||
from adafruit_led_animation.sequence import AnimationSequence
|
||||
from adafruit_led_animation.color import RED, BLUE
|
||||
|
||||
# Update to match the pin connected to your NeoPixels
|
||||
pixel_pin = board.D6
|
||||
# Update to match the number of NeoPixels you have connected
|
||||
pixel_num = 32
|
||||
|
||||
# Update to matchpin connected to button that connect logic high when pushed
|
||||
button_pin = board.D3
|
||||
|
||||
pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=0.5, auto_write=False)
|
||||
button = DigitalInOut(button_pin)
|
||||
button.direction = Direction.INPUT
|
||||
button.pull = Pull.UP
|
||||
|
||||
solid_blue = Solid(pixels, color=BLUE)
|
||||
solid_red = Solid(pixels, color=RED)
|
||||
animation_sequence = AnimationSequence(solid_blue, solid_red, auto_clear=True)
|
||||
|
||||
while True:
|
||||
animation_sequence.animate()
|
||||
|
||||
# Pressing the button pauses the animation permanently
|
||||
if not button.value:
|
||||
animation_sequence.next()
|
||||
while button.value:
|
||||
time.sleep(0.1) # Used for button debouncing
|
||||
38
examples/led_animation_freeze_animation.py
Normal file
38
examples/led_animation_freeze_animation.py
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
# SPDX-FileCopyrightText: 2021 Alec Delaney
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
"""
|
||||
This example uses Pulse animation along with a connected push button to freeze
|
||||
the animation permanently when pressed
|
||||
|
||||
For NeoPixel FeatherWing. Update pixel_pin and pixel_num to match your wiring if using
|
||||
a different form of NeoPixels.
|
||||
"""
|
||||
import board
|
||||
import neopixel
|
||||
from digitalio import DigitalInOut, Direction, Pull
|
||||
|
||||
from adafruit_led_animation.animation.pulse import Pulse
|
||||
from adafruit_led_animation.color import RED
|
||||
|
||||
# Update to match the pin connected to your NeoPixels
|
||||
pixel_pin = board.D6
|
||||
# Update to match the number of NeoPixels you have connected
|
||||
pixel_num = 32
|
||||
|
||||
# Update to matchpin connected to button that connect logic high when pushed
|
||||
button_pin = board.D3
|
||||
|
||||
pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=0.5, auto_write=False)
|
||||
button = DigitalInOut(button_pin)
|
||||
button.direction = Direction.INPUT
|
||||
button.pull = Pull.UP
|
||||
|
||||
pulse_animation = Pulse(pixels, speed=0.1, period=1, color=RED)
|
||||
|
||||
while True:
|
||||
pulse_animation.animate()
|
||||
|
||||
# Pressing the button pauses the animation permanently
|
||||
if not button.value:
|
||||
pulse_animation.freeze()
|
||||
|
|
@ -1,3 +1,7 @@
|
|||
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
|
||||
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
"""
|
||||
This example shows three different ways to use AnimationGroup: syncing two animations, displaying
|
||||
two animations at different speeds, and displaying two animations sequentially, across two separate
|
||||
|
|
@ -17,7 +21,7 @@ from adafruit_led_animation.animation.chase import Chase
|
|||
from adafruit_led_animation.group import AnimationGroup
|
||||
from adafruit_led_animation.sequence import AnimationSequence
|
||||
|
||||
import adafruit_led_animation.color as color
|
||||
from adafruit_led_animation import color
|
||||
|
||||
strip_pixels = neopixel.NeoPixel(board.A1, 30, brightness=0.5, auto_write=False)
|
||||
cp.pixels.brightness = 0.5
|
||||
|
|
|
|||
63
examples/led_animation_multicolor_comet.py
Normal file
63
examples/led_animation_multicolor_comet.py
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
# SPDX-FileCopyrightText: 2022 Tim Cocks
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
"""
|
||||
This example animates a red, yellow, and green gradient comet that bounces
|
||||
from end to end of the strip.
|
||||
|
||||
For QT Py Haxpress and a NeoPixel strip. Update pixel_pin and pixel_num to match your wiring if
|
||||
using a different board or form of NeoPixels.
|
||||
|
||||
This example will run on SAMD21 (M0) Express boards (such as Circuit Playground Express or QT Py
|
||||
Haxpress), but not on SAMD21 non-Express boards (such as QT Py or Trinket).
|
||||
"""
|
||||
import board
|
||||
import neopixel
|
||||
from adafruit_led_animation.animation.multicolor_comet import MulticolorComet
|
||||
|
||||
# Update to match the pin connected to your NeoPixels
|
||||
pixel_pin = board.D9
|
||||
# Update to match the number of NeoPixels you have connected
|
||||
pixel_num = 96
|
||||
brightness = 0.02
|
||||
|
||||
pixels = neopixel.NeoPixel(
|
||||
pixel_pin,
|
||||
pixel_num,
|
||||
brightness=brightness,
|
||||
auto_write=True,
|
||||
pixel_order=neopixel.RGB,
|
||||
)
|
||||
|
||||
comet_colors = [
|
||||
0xFF0000,
|
||||
0xFD2000,
|
||||
0xF93E00,
|
||||
0xF45B00,
|
||||
0xEC7500,
|
||||
0xE28D00,
|
||||
0xD5A200,
|
||||
0xC6B500,
|
||||
0xB5C600,
|
||||
0xA2D500,
|
||||
0x8DE200,
|
||||
0x75EC00,
|
||||
0x5BF400,
|
||||
0x3EF900,
|
||||
0x20FD00,
|
||||
0x00FF00,
|
||||
]
|
||||
|
||||
|
||||
comet = MulticolorComet(
|
||||
pixels,
|
||||
colors=comet_colors,
|
||||
speed=0.01,
|
||||
tail_length=20,
|
||||
bounce=True,
|
||||
ring=False,
|
||||
reverse=False,
|
||||
)
|
||||
|
||||
while True:
|
||||
comet.animate()
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
"""
|
||||
This example shows usage of the PixelMap helper to easily treat a single strip as a horizontal or
|
||||
vertical grid for animation purposes.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
"""
|
||||
This example uses AnimationsSequence to display multiple animations in sequence, at a five second
|
||||
interval.
|
||||
|
|
|
|||
40
examples/led_animation_resume_animation.py
Normal file
40
examples/led_animation_resume_animation.py
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
# SPDX-FileCopyrightText: 2021 Alec Delaney
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
"""
|
||||
This example uses Pulse animation along with a connected push button to start
|
||||
the animation when pressed
|
||||
|
||||
For NeoPixel FeatherWing. Update pixel_pin and pixel_num to match your wiring if using
|
||||
a different form of NeoPixels.
|
||||
"""
|
||||
import board
|
||||
import neopixel
|
||||
from digitalio import DigitalInOut, Direction, Pull
|
||||
|
||||
from adafruit_led_animation.animation.pulse import Pulse
|
||||
from adafruit_led_animation.color import RED
|
||||
|
||||
# Update to match the pin connected to your NeoPixels
|
||||
pixel_pin = board.D6
|
||||
# Update to match the number of NeoPixels you have connected
|
||||
pixel_num = 32
|
||||
|
||||
# Update to matchpin connected to button that connect logic high when pushed
|
||||
button_pin = board.D3
|
||||
|
||||
pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=0.5, auto_write=False)
|
||||
button = DigitalInOut(button_pin)
|
||||
button.direction = Direction.INPUT
|
||||
button.pull = Pull.UP
|
||||
|
||||
# Create the animation and freeze it afterwards
|
||||
pulse_animation = Pulse(pixels, speed=0.1, period=1, color=RED)
|
||||
pulse_animation.freeze()
|
||||
|
||||
while True:
|
||||
pulse_animation.animate()
|
||||
|
||||
# Pressing the button resumes (or in this case starts) the animation permanently
|
||||
if not button.value:
|
||||
pulse_animation.resume()
|
||||
40
examples/led_animation_samd21_reset_interval.py
Executable file
40
examples/led_animation_samd21_reset_interval.py
Executable file
|
|
@ -0,0 +1,40 @@
|
|||
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
"""
|
||||
This example shows how to reset the microcontroller to avoid the animation slowing down over time
|
||||
due to the limitations of CircuitPython for the SAMD21 (M0) microcontroller. The example
|
||||
animates a purple comet that bounces from end to end of the strip, and resets the board if the
|
||||
specified amount of time has passed since the board was last reset.
|
||||
|
||||
See this FAQ for details:
|
||||
https://learn.adafruit.com/circuitpython-led-animations/faqs#on-the-samd21-non-express-board-why-does-my-animation-slow-down-if-i-leave-it-running-for-a-while-3074335-3
|
||||
|
||||
For QT Py Haxpress and a NeoPixel strip. Update pixel_pin and pixel_num to match your wiring if
|
||||
using a different board or form of NeoPixels.
|
||||
|
||||
This example will run on SAMD21 (M0) Express boards (such as Circuit Playground Express or QT Py
|
||||
Haxpress), but not on SAMD21 non-Express boards (such as QT Py or Trinket).
|
||||
"""
|
||||
import time
|
||||
import microcontroller
|
||||
import board
|
||||
import neopixel
|
||||
|
||||
from adafruit_led_animation.animation.comet import Comet
|
||||
from adafruit_led_animation.color import PURPLE
|
||||
|
||||
# Update to match the pin connected to your NeoPixels
|
||||
pixel_pin = board.A3
|
||||
# Update to match the number of NeoPixels you have connected
|
||||
pixel_num = 30
|
||||
|
||||
pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=0.5, auto_write=False)
|
||||
|
||||
comet = Comet(pixels, speed=0.02, color=PURPLE, tail_length=10, bounce=True)
|
||||
|
||||
while True:
|
||||
comet.animate()
|
||||
|
||||
if time.monotonic() > 3600: # After an hour passes, reset the board.
|
||||
microcontroller.reset() # pylint: disable=no-member
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
"""
|
||||
This example uses AnimationsSequence to display multiple animations in sequence, at a five second
|
||||
interval.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
"""
|
||||
This simpletest example displays the Blink animation.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
"""
|
||||
This example uses AnimationsSequence to display multiple animations in sequence, at a five second
|
||||
interval.
|
||||
|
|
@ -24,7 +27,10 @@ sparkle = Sparkle(pixels, speed=0.05, color=AMBER, num_sparkles=10)
|
|||
sparkle_pulse = SparklePulse(pixels, speed=0.05, period=3, color=JADE)
|
||||
|
||||
animations = AnimationSequence(
|
||||
sparkle, sparkle_pulse, advance_interval=5, auto_clear=True,
|
||||
sparkle,
|
||||
sparkle_pulse,
|
||||
advance_interval=5,
|
||||
auto_clear=True,
|
||||
)
|
||||
|
||||
while True:
|
||||
|
|
|
|||
49
examples/led_animation_sparkle_mask.py
Normal file
49
examples/led_animation_sparkle_mask.py
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries, karan bhatia
|
||||
# SPDX-License-Identifier: MIT
|
||||
"""
|
||||
This example uses AnimationsSequence to display multiple animations in sequence, at a five second
|
||||
interval.
|
||||
|
||||
For NeoPixel FeatherWing. Update pixel_pin and pixel_num to match your wiring if using
|
||||
a different form of NeoPixels.
|
||||
"""
|
||||
import board
|
||||
import neopixel
|
||||
|
||||
from adafruit_led_animation.animation.sparkle import Sparkle
|
||||
from adafruit_led_animation.sequence import AnimationSequence
|
||||
from adafruit_led_animation.color import JADE, AQUA, PINK
|
||||
|
||||
# Update to match the pin connected to your NeoPixels
|
||||
pixel_pin = board.A1
|
||||
# Update to match the number of NeoPixels you have connected
|
||||
pixel_num = 64
|
||||
# fmt: off
|
||||
heart_mask = [ 1, 2, 5, 6,
|
||||
8, 9, 10, 11, 12, 13, 14, 15,
|
||||
16, 17, 18, 19, 20, 21, 22, 23,
|
||||
24, 25, 26, 27, 28, 29, 30, 31,
|
||||
33, 34, 35, 36, 37, 38,
|
||||
42, 43, 44, 45,
|
||||
51, 52]
|
||||
unheart_mask = [0, 3, 4, 7,
|
||||
|
||||
|
||||
|
||||
32, 39,
|
||||
40, 41, 46, 47,
|
||||
48, 49, 50, 53, 54, 55,
|
||||
56, 57, 58, 59, 60, 61, 62, 63]
|
||||
# fmt: on
|
||||
pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=0.9, auto_write=False)
|
||||
|
||||
animations = AnimationSequence(
|
||||
Sparkle(pixels, speed=0.05, color=JADE, num_sparkles=1, mask=unheart_mask),
|
||||
Sparkle(pixels, speed=0.05, color=AQUA, num_sparkles=1),
|
||||
Sparkle(pixels, speed=0.05, color=PINK, num_sparkles=1, mask=heart_mask),
|
||||
advance_interval=5,
|
||||
auto_clear=False,
|
||||
)
|
||||
|
||||
while True:
|
||||
animations.animate()
|
||||
3
optional_requirements.txt
Normal file
3
optional_requirements.txt
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# SPDX-FileCopyrightText: 2022 Alec Delaney, for Adafruit Industries
|
||||
#
|
||||
# SPDX-License-Identifier: Unlicense
|
||||
48
pyproject.toml
Normal file
48
pyproject.toml
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
# SPDX-FileCopyrightText: 2022 Alec Delaney for Adafruit Industries
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
[build-system]
|
||||
requires = [
|
||||
"setuptools",
|
||||
"wheel",
|
||||
"setuptools-scm",
|
||||
]
|
||||
|
||||
[project]
|
||||
name = "adafruit-circuitpython-led-animation"
|
||||
description = "CircuitPython helper for LED colors and animations."
|
||||
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_LED_Animation"}
|
||||
keywords = [
|
||||
"adafruit",
|
||||
"blinka",
|
||||
"circuitpython",
|
||||
"micropython",
|
||||
"led",
|
||||
"animation",
|
||||
"led",
|
||||
"colors",
|
||||
"animations",
|
||||
]
|
||||
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_led_animation"]
|
||||
|
||||
[tool.setuptools.dynamic]
|
||||
dependencies = {file = ["requirements.txt"]}
|
||||
optional-dependencies = {optional = {file = ["optional_requirements.txt"]}}
|
||||
|
|
@ -1 +1,5 @@
|
|||
# SPDX-FileCopyrightText: 2022 Alec Delaney, for Adafruit Industries
|
||||
#
|
||||
# SPDX-License-Identifier: Unlicense
|
||||
|
||||
Adafruit-Blinka
|
||||
|
|
|
|||
53
setup.py
53
setup.py
|
|
@ -1,53 +0,0 @@
|
|||
"""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(
|
||||
name="adafruit-circuitpython-led-animation",
|
||||
use_scm_version=True,
|
||||
setup_requires=["setuptools_scm"],
|
||||
description="CircuitPython helper for LED colors and animations.",
|
||||
long_description=long_description,
|
||||
long_description_content_type="text/x-rst",
|
||||
# The project's main homepage.
|
||||
url="https://github.com/adafruit/Adafruit_CircuitPython_LED_Animation",
|
||||
# Author details
|
||||
author="Adafruit Industries",
|
||||
author_email="circuitpython@adafruit.com",
|
||||
install_requires=["Adafruit-Blinka",],
|
||||
# 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 led animation led colors animations",
|
||||
# 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=['...']`
|
||||
packages=["adafruit_led_animation", "adafruit_led_animation.animation"],
|
||||
)
|
||||
Loading…
Reference in a new issue