commit
bd7ff021e5
22 changed files with 308 additions and 618 deletions
11
.gitattributes
vendored
Normal file
11
.gitattributes
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# SPDX-FileCopyrightText: 2024 Justin Myers for Adafruit Industries
|
||||
#
|
||||
# SPDX-License-Identifier: Unlicense
|
||||
|
||||
.py text eol=lf
|
||||
.rst text eol=lf
|
||||
.txt text eol=lf
|
||||
.yaml text eol=lf
|
||||
.toml text eol=lf
|
||||
.license text eol=lf
|
||||
.md text eol=lf
|
||||
|
|
@ -1,42 +1,21 @@
|
|||
# SPDX-FileCopyrightText: 2020 Diego Elio Pettenò
|
||||
# SPDX-FileCopyrightText: 2024 Justin Myers for Adafruit Industries
|
||||
#
|
||||
# SPDX-License-Identifier: Unlicense
|
||||
|
||||
repos:
|
||||
- repo: https://github.com/python/black
|
||||
rev: 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
|
||||
rev: v4.5.0
|
||||
hooks:
|
||||
- id: check-yaml
|
||||
- id: end-of-file-fixer
|
||||
- id: trailing-whitespace
|
||||
- repo: https://github.com/pycqa/pylint
|
||||
rev: v2.17.4
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.3.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
|
||||
- id: ruff-format
|
||||
- id: ruff
|
||||
args: ["--fix"]
|
||||
- repo: https://github.com/fsfe/reuse-tool
|
||||
rev: v3.0.1
|
||||
hooks:
|
||||
- id: reuse
|
||||
|
|
|
|||
399
.pylintrc
399
.pylintrc
|
|
@ -1,399 +0,0 @@
|
|||
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
|
||||
#
|
||||
# SPDX-License-Identifier: Unlicense
|
||||
|
||||
[MASTER]
|
||||
|
||||
# A comma-separated list of package or module names from where C extensions may
|
||||
# be loaded. Extensions are loading into the active Python interpreter and may
|
||||
# run arbitrary code
|
||||
extension-pkg-whitelist=
|
||||
|
||||
# Add files or directories to the ignore-list. They should be base names, not
|
||||
# paths.
|
||||
ignore=CVS
|
||||
|
||||
# Add files or directories matching the regex patterns to the ignore-list. The
|
||||
# regex matches against base names, not paths.
|
||||
ignore-patterns=
|
||||
|
||||
# Python code to execute, usually for sys.path manipulation such as
|
||||
# pygtk.require().
|
||||
#init-hook=
|
||||
|
||||
# Use multiple processes to speed up Pylint.
|
||||
jobs=1
|
||||
|
||||
# List of plugins (as comma separated values of python modules names) to load,
|
||||
# usually to register additional checkers.
|
||||
load-plugins=pylint.extensions.no_self_use
|
||||
|
||||
# Pickle collected data for later comparisons.
|
||||
persistent=yes
|
||||
|
||||
# Specify a configuration file.
|
||||
#rcfile=
|
||||
|
||||
# Allow loading of arbitrary C extensions. Extensions are imported into the
|
||||
# active Python interpreter and may run arbitrary code.
|
||||
unsafe-load-any-extension=no
|
||||
|
||||
|
||||
[MESSAGES CONTROL]
|
||||
|
||||
# Only show warnings with the listed confidence levels. Leave empty to show
|
||||
# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED
|
||||
confidence=
|
||||
|
||||
# Disable the message, report, category or checker with the given id(s). You
|
||||
# can either give multiple identifiers separated by comma (,) or put this
|
||||
# option multiple times (only on the command line, not in the configuration
|
||||
# file where it should appear only once).You can also use "--disable=all" to
|
||||
# disable everything first and then reenable specific checks. For example, if
|
||||
# you want to run only the similarities checker, you can use "--disable=all
|
||||
# --enable=similarities". If you want to run only the classes checker, but have
|
||||
# no Warning level messages displayed, use"--disable=all --enable=classes
|
||||
# --disable=W"
|
||||
# disable=import-error,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
|
||||
# multiple time (only on the command line, not in the configuration file where
|
||||
# it should appear only once). See also the "--disable" option for examples.
|
||||
enable=
|
||||
|
||||
|
||||
[REPORTS]
|
||||
|
||||
# Python expression which should return a note less than 10 (10 is the highest
|
||||
# note). You have access to the variables errors warning, statement which
|
||||
# respectively contain the number of errors / warnings messages and the total
|
||||
# number of statements analyzed. This is used by the global evaluation report
|
||||
# (RP0004).
|
||||
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
|
||||
|
||||
# Template used to display messages. This is a python new-style format string
|
||||
# used to format the message information. See doc for all details
|
||||
#msg-template=
|
||||
|
||||
# Set the output format. Available formats are text, parseable, colorized, json
|
||||
# and msvs (visual studio).You can also give a reporter class, eg
|
||||
# mypackage.mymodule.MyReporterClass.
|
||||
output-format=text
|
||||
|
||||
# Tells whether to display a full report or only the messages
|
||||
reports=no
|
||||
|
||||
# Activate the evaluation score.
|
||||
score=yes
|
||||
|
||||
|
||||
[REFACTORING]
|
||||
|
||||
# Maximum number of nested blocks for function / method body
|
||||
max-nested-blocks=5
|
||||
|
||||
|
||||
[LOGGING]
|
||||
|
||||
# Logging modules to check that the string format arguments are in logging
|
||||
# function parameter format
|
||||
logging-modules=logging
|
||||
|
||||
|
||||
[SPELLING]
|
||||
|
||||
# Spelling dictionary name. Available dictionaries: none. To make it working
|
||||
# install python-enchant package.
|
||||
spelling-dict=
|
||||
|
||||
# List of comma separated words that should not be checked.
|
||||
spelling-ignore-words=
|
||||
|
||||
# A path to a file that contains private dictionary; one word per line.
|
||||
spelling-private-dict-file=
|
||||
|
||||
# Tells whether to store unknown words to indicated private dictionary in
|
||||
# --spelling-private-dict-file option instead of raising a message.
|
||||
spelling-store-unknown-words=no
|
||||
|
||||
|
||||
[MISCELLANEOUS]
|
||||
|
||||
# List of note tags to take in consideration, separated by a comma.
|
||||
# notes=FIXME,XXX,TODO
|
||||
notes=FIXME,XXX
|
||||
|
||||
|
||||
[TYPECHECK]
|
||||
|
||||
# List of decorators that produce context managers, such as
|
||||
# contextlib.contextmanager. Add to this list to register other decorators that
|
||||
# produce valid context managers.
|
||||
contextmanager-decorators=contextlib.contextmanager
|
||||
|
||||
# List of members which are set dynamically and missed by pylint inference
|
||||
# system, and so shouldn't trigger E1101 when accessed. Python regular
|
||||
# expressions are accepted.
|
||||
generated-members=
|
||||
|
||||
# Tells whether missing members accessed in mixin class should be ignored. A
|
||||
# mixin class is detected if its name ends with "mixin" (case insensitive).
|
||||
ignore-mixin-members=yes
|
||||
|
||||
# This flag controls whether pylint should warn about no-member and similar
|
||||
# checks whenever an opaque object is returned when inferring. The inference
|
||||
# can return multiple potential results while evaluating a Python object, but
|
||||
# some branches might not be evaluated, which results in partial inference. In
|
||||
# that case, it might be useful to still emit no-member and other checks for
|
||||
# the rest of the inferred objects.
|
||||
ignore-on-opaque-inference=yes
|
||||
|
||||
# List of class names for which member attributes should not be checked (useful
|
||||
# for classes with dynamically set attributes). This supports the use of
|
||||
# qualified names.
|
||||
ignored-classes=optparse.Values,thread._local,_thread._local
|
||||
|
||||
# List of module names for which member attributes should not be checked
|
||||
# (useful for modules/projects where namespaces are manipulated during runtime
|
||||
# and thus existing member attributes cannot be deduced by static analysis. It
|
||||
# supports qualified module names, as well as Unix pattern matching.
|
||||
ignored-modules=board
|
||||
|
||||
# Show a hint with possible names when a member name was not found. The aspect
|
||||
# of finding the hint is based on edit distance.
|
||||
missing-member-hint=yes
|
||||
|
||||
# The minimum edit distance a name should have in order to be considered a
|
||||
# similar match for a missing member name.
|
||||
missing-member-hint-distance=1
|
||||
|
||||
# The total number of similar names that should be taken in consideration when
|
||||
# showing a hint for a missing member.
|
||||
missing-member-max-choices=1
|
||||
|
||||
|
||||
[VARIABLES]
|
||||
|
||||
# List of additional names supposed to be defined in builtins. Remember that
|
||||
# you should avoid to define new builtins when possible.
|
||||
additional-builtins=
|
||||
|
||||
# Tells whether unused global variables should be treated as a violation.
|
||||
allow-global-unused-variables=yes
|
||||
|
||||
# List of strings which can identify a callback function by name. A callback
|
||||
# name must start or end with one of those strings.
|
||||
callbacks=cb_,_cb
|
||||
|
||||
# A regular expression matching the name of dummy variables (i.e. expectedly
|
||||
# not used).
|
||||
dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_
|
||||
|
||||
# Argument names that match this expression will be ignored. Default to name
|
||||
# with leading underscore
|
||||
ignored-argument-names=_.*|^ignored_|^unused_
|
||||
|
||||
# Tells whether we should check for unused import in __init__ files.
|
||||
init-import=no
|
||||
|
||||
# List of qualified module names which can have objects that can redefine
|
||||
# builtins.
|
||||
redefining-builtins-modules=six.moves,future.builtins
|
||||
|
||||
|
||||
[FORMAT]
|
||||
|
||||
# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
|
||||
# expected-line-ending-format=
|
||||
expected-line-ending-format=LF
|
||||
|
||||
# Regexp for a line that is allowed to be longer than the limit.
|
||||
ignore-long-lines=^\s*(# )?<?https?://\S+>?$
|
||||
|
||||
# Number of spaces of indent required inside a hanging or continued line.
|
||||
indent-after-paren=4
|
||||
|
||||
# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
|
||||
# tab).
|
||||
indent-string=' '
|
||||
|
||||
# Maximum number of characters on a single line.
|
||||
max-line-length=100
|
||||
|
||||
# Maximum number of lines in a module
|
||||
max-module-lines=1000
|
||||
|
||||
# Allow the body of a class to be on the same line as the declaration if body
|
||||
# contains single statement.
|
||||
single-line-class-stmt=no
|
||||
|
||||
# Allow the body of an if to be on the same line as the test if there is no
|
||||
# else.
|
||||
single-line-if-stmt=no
|
||||
|
||||
|
||||
[SIMILARITIES]
|
||||
|
||||
# Ignore comments when computing similarities.
|
||||
ignore-comments=yes
|
||||
|
||||
# Ignore docstrings when computing similarities.
|
||||
ignore-docstrings=yes
|
||||
|
||||
# Ignore imports when computing similarities.
|
||||
ignore-imports=yes
|
||||
|
||||
# Minimum lines number of a similarity.
|
||||
min-similarity-lines=12
|
||||
|
||||
|
||||
[BASIC]
|
||||
|
||||
# Regular expression matching correct argument names
|
||||
argument-rgx=(([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
|
||||
|
||||
# Regular expression matching correct class attribute names
|
||||
class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
|
||||
|
||||
# Regular expression matching correct class names
|
||||
# class-rgx=[A-Z_][a-zA-Z0-9]+$
|
||||
class-rgx=[A-Z_][a-zA-Z0-9_]+$
|
||||
|
||||
# Regular expression matching correct constant names
|
||||
const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
|
||||
|
||||
# Minimum line length for functions/classes that require docstrings, shorter
|
||||
# ones are exempt.
|
||||
docstring-min-length=-1
|
||||
|
||||
# Regular expression matching correct function names
|
||||
function-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
|
||||
|
||||
# Good variable names which should always be accepted, separated by a comma
|
||||
# good-names=i,j,k,ex,Run,_
|
||||
good-names=r,g,b,w,i,j,k,n,x,y,z,ex,ok,Run,_
|
||||
|
||||
# Include a hint for the correct naming format with invalid-name
|
||||
include-naming-hint=no
|
||||
|
||||
# Regular expression matching correct inline iteration names
|
||||
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
|
||||
|
||||
# Regular expression matching correct method names
|
||||
method-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
|
||||
|
||||
# Regular expression matching correct module names
|
||||
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
|
||||
|
||||
# Colon-delimited sets of names that determine each other's naming style when
|
||||
# the name regexes allow several styles.
|
||||
name-group=
|
||||
|
||||
# Regular expression which should only match function or class names that do
|
||||
# not require a docstring.
|
||||
no-docstring-rgx=^_
|
||||
|
||||
# List of decorators that produce properties, such as abc.abstractproperty. Add
|
||||
# to this list to register other decorators that produce valid properties.
|
||||
property-classes=abc.abstractproperty
|
||||
|
||||
# Regular expression matching correct variable names
|
||||
variable-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
|
||||
|
||||
|
||||
[IMPORTS]
|
||||
|
||||
# Allow wildcard imports from modules that define __all__.
|
||||
allow-wildcard-with-all=no
|
||||
|
||||
# Analyse import fallback blocks. This can be used to support both Python 2 and
|
||||
# 3 compatible code, which means that the block might have code that exists
|
||||
# only in one or another interpreter, leading to false positives when analysed.
|
||||
analyse-fallback-blocks=no
|
||||
|
||||
# Deprecated modules which should not be used, separated by a comma
|
||||
deprecated-modules=optparse,tkinter.tix
|
||||
|
||||
# Create a graph of external dependencies in the given file (report RP0402 must
|
||||
# not be disabled)
|
||||
ext-import-graph=
|
||||
|
||||
# Create a graph of every (i.e. internal and external) dependencies in the
|
||||
# given file (report RP0402 must not be disabled)
|
||||
import-graph=
|
||||
|
||||
# Create a graph of internal dependencies in the given file (report RP0402 must
|
||||
# not be disabled)
|
||||
int-import-graph=
|
||||
|
||||
# Force import order to recognize a module as part of the standard
|
||||
# compatibility libraries.
|
||||
known-standard-library=
|
||||
|
||||
# Force import order to recognize a module as part of a third party library.
|
||||
known-third-party=enchant
|
||||
|
||||
|
||||
[CLASSES]
|
||||
|
||||
# List of method names used to declare (i.e. assign) instance attributes.
|
||||
defining-attr-methods=__init__,__new__,setUp
|
||||
|
||||
# List of member names, which should be excluded from the protected access
|
||||
# warning.
|
||||
exclude-protected=_asdict,_fields,_replace,_source,_make
|
||||
|
||||
# List of valid names for the first argument in a class method.
|
||||
valid-classmethod-first-arg=cls
|
||||
|
||||
# List of valid names for the first argument in a metaclass class method.
|
||||
valid-metaclass-classmethod-first-arg=mcs
|
||||
|
||||
|
||||
[DESIGN]
|
||||
|
||||
# Maximum number of arguments for function / method
|
||||
max-args=5
|
||||
|
||||
# Maximum number of attributes for a class (see R0902).
|
||||
# max-attributes=7
|
||||
max-attributes=11
|
||||
|
||||
# Maximum number of boolean expressions in a if statement
|
||||
max-bool-expr=5
|
||||
|
||||
# Maximum number of branch for function / method body
|
||||
max-branches=12
|
||||
|
||||
# Maximum number of locals for function / method body
|
||||
max-locals=15
|
||||
|
||||
# Maximum number of parents for a class (see R0901).
|
||||
max-parents=7
|
||||
|
||||
# Maximum number of public methods for a class (see R0904).
|
||||
max-public-methods=20
|
||||
|
||||
# Maximum number of return / yield for function / method body
|
||||
max-returns=6
|
||||
|
||||
# Maximum number of statements in function / method body
|
||||
max-statements=50
|
||||
|
||||
# Minimum number of public methods for a class (see R0903).
|
||||
min-public-methods=1
|
||||
|
||||
|
||||
[EXCEPTIONS]
|
||||
|
||||
# Exceptions that will emit a warning when being caught. Defaults to
|
||||
# "Exception"
|
||||
overgeneral-exceptions=builtins.Exception
|
||||
|
|
@ -13,9 +13,9 @@ Introduction
|
|||
:target: https://github.com/adafruit/Adafruit_CircuitPython_IS31FL3741/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
|
||||
.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
|
||||
:target: https://github.com/astral-sh/ruff
|
||||
:alt: Code Style: Ruff
|
||||
|
||||
CircuitPython driver for the IS31FL3741 RGB Matrix IC.
|
||||
|
||||
|
|
|
|||
|
|
@ -25,17 +25,19 @@ Implementation Notes
|
|||
"""
|
||||
|
||||
from sys import implementation
|
||||
|
||||
from adafruit_bus_device import i2c_device
|
||||
from adafruit_register.i2c_struct import ROUnaryStruct, UnaryStruct
|
||||
from adafruit_register.i2c_bit import RWBit
|
||||
from adafruit_register.i2c_struct import ROUnaryStruct, UnaryStruct
|
||||
|
||||
try:
|
||||
# Used only for typing
|
||||
from typing import Optional, Tuple, Union # pylint: disable=unused-import
|
||||
from circuitpython_typing.pil import Image
|
||||
from circuitpython_typing import ReadableBuffer
|
||||
from adafruit_framebuf import FrameBuffer
|
||||
from typing import Optional, Tuple, Union
|
||||
|
||||
import busio
|
||||
from adafruit_framebuf import FrameBuffer
|
||||
from circuitpython_typing import ReadableBuffer
|
||||
from circuitpython_typing.pil import Image
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
|
|
@ -281,7 +283,6 @@ class IS31FL3741_colorXY(IS31FL3741):
|
|||
above. Default is IS3741_BGR.
|
||||
"""
|
||||
|
||||
# pylint: disable-msg=too-many-arguments
|
||||
def __init__(
|
||||
self,
|
||||
i2c: busio.I2C,
|
||||
|
|
@ -367,9 +368,7 @@ class IS31FL3741_colorXY(IS31FL3741):
|
|||
raise ValueError("Image must be in mode RGB.")
|
||||
if img.size[0] != self.width or img.size[1] != self.height:
|
||||
raise ValueError(
|
||||
"Image must be same dimensions as display ({0}x{1}).".format(
|
||||
self.width, self.height
|
||||
)
|
||||
f"Image must be same dimensions as display ({self.width}x{self.height})."
|
||||
)
|
||||
|
||||
# Iterate X/Y through all image pixels
|
||||
|
|
|
|||
|
|
@ -22,14 +22,17 @@ Implementation Notes
|
|||
https://github.com/adafruit/circuitpython/releases
|
||||
|
||||
"""
|
||||
from struct import unpack_from # pylint: disable=no-name-in-module
|
||||
|
||||
from adafruit_is31fl3741 import _IS3741_ADDR_DEFAULT, NO_BUFFER, IS3741_BGR, MUST_BUFFER
|
||||
from struct import unpack_from
|
||||
|
||||
from adafruit_is31fl3741 import _IS3741_ADDR_DEFAULT, IS3741_BGR, MUST_BUFFER, NO_BUFFER
|
||||
|
||||
from . import IS31FL3741_colorXY
|
||||
|
||||
try:
|
||||
# Used only for typing
|
||||
from typing import Tuple, Any # pylint: disable=unused-import
|
||||
from typing import Any, Tuple
|
||||
|
||||
import busio
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
@ -89,30 +92,30 @@ class Right_Ring(BaseRing):
|
|||
"""The right eye ring of the LED glasses"""
|
||||
|
||||
ledmap_bytes = (
|
||||
b"\x01\x1F\x00\x1E\x00\x1F"
|
||||
b"\x01\x1f\x00\x1e\x00\x1f"
|
||||
b"\x01\x16\x00\x00\x00\x01"
|
||||
b"\x01\x11\x01\x13\x01\x12"
|
||||
b"\x01\x1A\x01\x1C\x01\x1B"
|
||||
b"\x01\x0E\x01\x10\x01\x0F"
|
||||
b"\x00\x1B\x00\x1D\x00\x1C"
|
||||
b"\x01\x1a\x01\x1c\x01\x1b"
|
||||
b"\x01\x0e\x01\x10\x01\x0f"
|
||||
b"\x00\x1b\x00\x1d\x00\x1c"
|
||||
b"\x00\x17\x00\x19\x00\x18"
|
||||
b"\x01\x14\x00\x16\x01\x15"
|
||||
b"\x00\x14\x00\x1A\x00\x15"
|
||||
b"\x00\x14\x00\x1a\x00\x15"
|
||||
b"\x00\x32\x00\x38\x00\x33"
|
||||
b"\x00\x50\x00\x56\x00\x51"
|
||||
b"\x00\x6E\x00\x74\x00\x6F"
|
||||
b"\x00\x8C\x00\x92\x00\x8D"
|
||||
b"\x00\xAA\x00\xB0\x00\xAB"
|
||||
b"\x00\xC8\x00\xCE\x00\xC9"
|
||||
b"\x00\xE6\x00\xEC\x00\xE7"
|
||||
b"\x01\x04\x01\x0A\x01\x05"
|
||||
b"\x01\x5C\x01\x06\x01\x5D"
|
||||
b"\x00\xE9\x00\xEB\x00\xEA"
|
||||
b"\x00\xED\x00\xEF\x00\xEE"
|
||||
b"\x01\x53\x00\xE8\x01\x54"
|
||||
b"\x00\x6e\x00\x74\x00\x6f"
|
||||
b"\x00\x8c\x00\x92\x00\x8d"
|
||||
b"\x00\xaa\x00\xb0\x00\xab"
|
||||
b"\x00\xc8\x00\xce\x00\xc9"
|
||||
b"\x00\xe6\x00\xec\x00\xe7"
|
||||
b"\x01\x04\x01\x0a\x01\x05"
|
||||
b"\x01\x5c\x01\x06\x01\x5d"
|
||||
b"\x00\xe9\x00\xeb\x00\xea"
|
||||
b"\x00\xed\x00\xef\x00\xee"
|
||||
b"\x01\x53\x00\xe8\x01\x54"
|
||||
b"\x01\x47\x01\x49\x01\x48"
|
||||
b"\x01\x31\x00\x5A\x00\x5B"
|
||||
b"\x01\x28\x00\x3C\x00\x3D"
|
||||
b"\x01\x31\x00\x5a\x00\x5b"
|
||||
b"\x01\x28\x00\x3c\x00\x3d"
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -120,30 +123,30 @@ class Left_Ring(BaseRing):
|
|||
"""The left eye ring of the LED glasses"""
|
||||
|
||||
ledmap_bytes = (
|
||||
b"\x01\x55\x00\xD2\x00\xD3"
|
||||
b"\x01\x4C\x00\xB4\x00\xB5"
|
||||
b"\x01\x55\x00\xd2\x00\xd3"
|
||||
b"\x01\x4c\x00\xb4\x00\xb5"
|
||||
b"\x01\x43\x00\x96\x00\x97"
|
||||
b"\x00\x7F\x00\x7D\x00\x7E"
|
||||
b"\x00\x9A\x00\x98\x00\x99"
|
||||
b"\x00\xA3\x00\xA1\x00\xA2"
|
||||
b"\x00\xA6\x00\xA4\x00\xA5"
|
||||
b"\x00\xF4\x00\xF2\x00\xF3"
|
||||
b"\x00\x7f\x00\x7d\x00\x7e"
|
||||
b"\x00\x9a\x00\x98\x00\x99"
|
||||
b"\x00\xa3\x00\xa1\x00\xa2"
|
||||
b"\x00\xa6\x00\xa4\x00\xa5"
|
||||
b"\x00\xf4\x00\xf2\x00\xf3"
|
||||
b"\x01\x03\x01\x01\x01\x02"
|
||||
b"\x00\xA9\x00\xA7\x00\xA8"
|
||||
b"\x00\x8B\x00\x89\x00\x8A"
|
||||
b"\x00\x6D\x00\x6B\x00\x6C"
|
||||
b"\x00\x4F\x00\x4D\x00\x4E"
|
||||
b"\x00\x31\x00\x2F\x00\x30"
|
||||
b"\x00\xC7\x00\xC5\x00\xC6"
|
||||
b"\x00\xE5\x00\xE3\x00\xE4"
|
||||
b"\x00\xa9\x00\xa7\x00\xa8"
|
||||
b"\x00\x8b\x00\x89\x00\x8a"
|
||||
b"\x00\x6d\x00\x6b\x00\x6c"
|
||||
b"\x00\x4f\x00\x4d\x00\x4e"
|
||||
b"\x00\x31\x00\x2f\x00\x30"
|
||||
b"\x00\xc7\x00\xc5\x00\xc6"
|
||||
b"\x00\xe5\x00\xe3\x00\xe4"
|
||||
b"\x00\x13\x00\x11\x00\x12"
|
||||
b"\x00\x04\x00\x02\x00\x03"
|
||||
b"\x00\x10\x00\x0E\x00\x0F"
|
||||
b"\x00\x0D\x00\x0B\x00\x0C"
|
||||
b"\x00\x0A\x00\x08\x00\x09"
|
||||
b"\x00\xD9\x00\xD7\x00\xD8"
|
||||
b"\x00\x10\x00\x0e\x00\x0f"
|
||||
b"\x00\x0d\x00\x0b\x00\x0c"
|
||||
b"\x00\x0a\x00\x08\x00\x09"
|
||||
b"\x00\xd9\x00\xd7\x00\xd8"
|
||||
b"\x00\x07\x00\x05\x00\x06"
|
||||
b"\x01\x5E\x00\xF0\x00\xF1"
|
||||
b"\x01\x5e\x00\xf0\x00\xf1"
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -154,94 +157,94 @@ class LED_Glasses(IS31FL3741_colorXY):
|
|||
# 120, 121 and 314 (elements unused by the glasses, which has 116 RGB
|
||||
# LEDs of a possible 117).
|
||||
ledmap_bytes = (
|
||||
b"\x00\x78\x00\x79\x01\x3A"
|
||||
b"\x00\x0A\x00\x08\x00\x09"
|
||||
b"\x00\x0D\x00\x0B\x00\x0C"
|
||||
b"\x00\x10\x00\x0E\x00\x0F"
|
||||
b"\x00\x78\x00\x79\x01\x3a"
|
||||
b"\x00\x0a\x00\x08\x00\x09"
|
||||
b"\x00\x0d\x00\x0b\x00\x0c"
|
||||
b"\x00\x10\x00\x0e\x00\x0f"
|
||||
b"\x00\x04\x00\x02\x00\x03"
|
||||
b"\x00\xD9\x00\xD7\x00\xD8"
|
||||
b"\x00\xDC\x00\xDA\x00\xDB"
|
||||
b"\x00\xDF\x00\xDD\x00\xDE"
|
||||
b"\x00\xE2\x00\xE0\x00\xE1"
|
||||
b"\x00\xD6\x00\xD4\x00\xD5"
|
||||
b"\x00\xBB\x00\xB9\x00\xBA"
|
||||
b"\x00\xBE\x00\xBC\x00\xBD"
|
||||
b"\x00\xC1\x00\xBF\x00\xC0"
|
||||
b"\x00\xC4\x00\xC2\x00\xC3"
|
||||
b"\x00\xB8\x00\xB6\x00\xB7"
|
||||
b"\x00\xd9\x00\xd7\x00\xd8"
|
||||
b"\x00\xdc\x00\xda\x00\xdb"
|
||||
b"\x00\xdf\x00\xdd\x00\xde"
|
||||
b"\x00\xe2\x00\xe0\x00\xe1"
|
||||
b"\x00\xd6\x00\xd4\x00\xd5"
|
||||
b"\x00\xbb\x00\xb9\x00\xba"
|
||||
b"\x00\xbe\x00\xbc\x00\xbd"
|
||||
b"\x00\xc1\x00\xbf\x00\xc0"
|
||||
b"\x00\xc4\x00\xc2\x00\xc3"
|
||||
b"\x00\xb8\x00\xb6\x00\xb7"
|
||||
b"\x00\x25\x00\x23\x00\x24"
|
||||
b"\x00\x28\x00\x26\x00\x27"
|
||||
b"\x00\x2B\x00\x29\x00\x2A"
|
||||
b"\x00\x2E\x00\x2C\x00\x2D"
|
||||
b"\x00\x2b\x00\x29\x00\x2a"
|
||||
b"\x00\x2e\x00\x2c\x00\x2d"
|
||||
b"\x00\x22\x00\x20\x00\x21"
|
||||
b"\x00\x43\x00\x41\x00\x42"
|
||||
b"\x00\x46\x00\x44\x00\x45"
|
||||
b"\x00\x49\x00\x47\x00\x48"
|
||||
b"\x00\x4C\x00\x4A\x00\x4B"
|
||||
b"\x00\x40\x00\x3E\x00\x3F"
|
||||
b"\x00\x61\x00\x5F\x00\x60"
|
||||
b"\x00\x4c\x00\x4a\x00\x4b"
|
||||
b"\x00\x40\x00\x3e\x00\x3f"
|
||||
b"\x00\x61\x00\x5f\x00\x60"
|
||||
b"\x00\x64\x00\x62\x00\x63"
|
||||
b"\x00\x67\x00\x65\x00\x66"
|
||||
b"\x00\x6A\x00\x68\x00\x69"
|
||||
b"\x00\x5E\x00\x5C\x00\x5D"
|
||||
b"\x00\x7F\x00\x7D\x00\x7E"
|
||||
b"\x00\x6a\x00\x68\x00\x69"
|
||||
b"\x00\x5e\x00\x5c\x00\x5d"
|
||||
b"\x00\x7f\x00\x7d\x00\x7e"
|
||||
b"\x00\x82\x00\x80\x00\x81"
|
||||
b"\x00\x85\x00\x83\x00\x84"
|
||||
b"\x00\x88\x00\x86\x00\x87"
|
||||
b"\x00\x7C\x00\x7A\x00\x7B"
|
||||
b"\x00\x9D\x00\x9B\x00\x9C"
|
||||
b"\x00\xA0\x00\x9E\x00\x9F"
|
||||
b"\x00\xA3\x00\xA1\x00\xA2"
|
||||
b"\x00\xA6\x00\xA4\x00\xA5"
|
||||
b"\x00\xF4\x00\xF2\x00\xF3"
|
||||
b"\x00\xF7\x00\xF5\x00\xF6"
|
||||
b"\x00\xFA\x00\xF8\x00\xF9"
|
||||
b"\x00\xFD\x00\xFB\x00\xFC"
|
||||
b"\x01\x00\x00\xFE\x00\xFF"
|
||||
b"\x00\x78\x00\x79\x01\x3A"
|
||||
b"\x01\x59\x01\x5B\x01\x5A"
|
||||
b"\x00\x7c\x00\x7a\x00\x7b"
|
||||
b"\x00\x9d\x00\x9b\x00\x9c"
|
||||
b"\x00\xa0\x00\x9e\x00\x9f"
|
||||
b"\x00\xa3\x00\xa1\x00\xa2"
|
||||
b"\x00\xa6\x00\xa4\x00\xa5"
|
||||
b"\x00\xf4\x00\xf2\x00\xf3"
|
||||
b"\x00\xf7\x00\xf5\x00\xf6"
|
||||
b"\x00\xfa\x00\xf8\x00\xf9"
|
||||
b"\x00\xfd\x00\xfb\x00\xfc"
|
||||
b"\x01\x00\x00\xfe\x00\xff"
|
||||
b"\x00\x78\x00\x79\x01\x3a"
|
||||
b"\x01\x59\x01\x5b\x01\x5a"
|
||||
b"\x01\x56\x01\x58\x01\x57"
|
||||
b"\x01\x0B\x01\x0D\x01\x0C"
|
||||
b"\x01\x0b\x01\x0d\x01\x0c"
|
||||
b"\x01\x07\x01\x09\x01\x08"
|
||||
b"\x00\x78\x00\x79\x01\x3A"
|
||||
b"\x00\x78\x00\x79\x01\x3a"
|
||||
b"\x01\x50\x01\x52\x01\x51"
|
||||
b"\x01\x4D\x01\x4F\x01\x4E"
|
||||
b"\x00\xED\x00\xEF\x00\xEE"
|
||||
b"\x00\xE9\x00\xEB\x00\xEA"
|
||||
b"\x01\x5C\x01\x06\x01\x5D"
|
||||
b"\x01\x4d\x01\x4f\x01\x4e"
|
||||
b"\x00\xed\x00\xef\x00\xee"
|
||||
b"\x00\xe9\x00\xeb\x00\xea"
|
||||
b"\x01\x5c\x01\x06\x01\x5d"
|
||||
b"\x01\x47\x01\x49\x01\x48"
|
||||
b"\x01\x44\x01\x46\x01\x45"
|
||||
b"\x00\xCF\x00\xD1\x00\xD0"
|
||||
b"\x00\xCB\x00\xCD\x00\xCC"
|
||||
b"\x01\x4A\x00\xCA\x01\x4B"
|
||||
b"\x01\x3E\x01\x40\x01\x3F"
|
||||
b"\x01\x3B\x01\x3D\x01\x3C"
|
||||
b"\x00\xB1\x00\xB3\x00\xB2"
|
||||
b"\x00\xAD\x00\xAF\x00\xAE"
|
||||
b"\x01\x41\x00\xAC\x01\x42"
|
||||
b"\x00\xcf\x00\xd1\x00\xd0"
|
||||
b"\x00\xcb\x00\xcd\x00\xcc"
|
||||
b"\x01\x4a\x00\xca\x01\x4b"
|
||||
b"\x01\x3e\x01\x40\x01\x3f"
|
||||
b"\x01\x3b\x01\x3d\x01\x3c"
|
||||
b"\x00\xb1\x00\xb3\x00\xb2"
|
||||
b"\x00\xad\x00\xaf\x00\xae"
|
||||
b"\x01\x41\x00\xac\x01\x42"
|
||||
b"\x01\x35\x01\x37\x01\x36"
|
||||
b"\x01\x32\x01\x34\x01\x33"
|
||||
b"\x00\x93\x00\x95\x00\x94"
|
||||
b"\x00\x8F\x00\x91\x00\x90"
|
||||
b"\x01\x38\x00\x8E\x01\x39"
|
||||
b"\x01\x2C\x01\x2E\x01\x2D"
|
||||
b"\x01\x29\x01\x2B\x01\x2A"
|
||||
b"\x00\x8f\x00\x91\x00\x90"
|
||||
b"\x01\x38\x00\x8e\x01\x39"
|
||||
b"\x01\x2c\x01\x2e\x01\x2d"
|
||||
b"\x01\x29\x01\x2b\x01\x2a"
|
||||
b"\x00\x75\x00\x77\x00\x76"
|
||||
b"\x00\x71\x00\x73\x00\x72"
|
||||
b"\x01\x2F\x00\x70\x01\x30"
|
||||
b"\x01\x2f\x00\x70\x01\x30"
|
||||
b"\x01\x23\x01\x25\x01\x24"
|
||||
b"\x01\x20\x01\x22\x01\x21"
|
||||
b"\x00\x57\x00\x59\x00\x58"
|
||||
b"\x00\x53\x00\x55\x00\x54"
|
||||
b"\x01\x26\x00\x52\x01\x27"
|
||||
b"\x01\x1A\x01\x1C\x01\x1B"
|
||||
b"\x01\x1a\x01\x1c\x01\x1b"
|
||||
b"\x01\x17\x01\x19\x01\x18"
|
||||
b"\x00\x39\x00\x3B\x00\x3A"
|
||||
b"\x00\x39\x00\x3b\x00\x3a"
|
||||
b"\x00\x35\x00\x37\x00\x36"
|
||||
b"\x01\x1D\x00\x34\x01\x1E"
|
||||
b"\x00\x78\x00\x79\x01\x3A"
|
||||
b"\x01\x0E\x01\x10\x01\x0F"
|
||||
b"\x00\x1B\x00\x1D\x00\x1C"
|
||||
b"\x01\x1d\x00\x34\x01\x1e"
|
||||
b"\x00\x78\x00\x79\x01\x3a"
|
||||
b"\x01\x0e\x01\x10\x01\x0f"
|
||||
b"\x00\x1b\x00\x1d\x00\x1c"
|
||||
b"\x00\x17\x00\x19\x00\x18"
|
||||
b"\x01\x14\x00\x16\x01\x15"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -24,12 +24,14 @@ Implementation Notes
|
|||
"""
|
||||
|
||||
# imports
|
||||
from adafruit_is31fl3741 import _IS3741_ADDR_DEFAULT, NO_BUFFER, IS3741_BGR
|
||||
from adafruit_is31fl3741 import _IS3741_ADDR_DEFAULT, IS3741_BGR, NO_BUFFER
|
||||
|
||||
from . import IS31FL3741_colorXY
|
||||
|
||||
try:
|
||||
# Used only for typing
|
||||
from typing import Tuple
|
||||
|
||||
import busio
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -19,9 +19,11 @@ import adafruit_pixelbuf
|
|||
|
||||
try:
|
||||
# Used only for typing
|
||||
from typing import Optional, Type, Union
|
||||
from types import TracebackType
|
||||
from typing import Optional, Type, Union
|
||||
|
||||
import is31fl3741
|
||||
|
||||
from . import IS31FL3741
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
@ -87,7 +89,7 @@ class IS31FL3741_PixelBuf(adafruit_pixelbuf.PixelBuf):
|
|||
brightness: float = 1.0,
|
||||
auto_write: bool = True,
|
||||
pixel_order: str = None,
|
||||
init: bool = True
|
||||
init: bool = True,
|
||||
):
|
||||
if not pixel_order:
|
||||
pixel_order = BGR if bpp == 3 else GRBW
|
||||
|
|
@ -97,9 +99,7 @@ class IS31FL3741_PixelBuf(adafruit_pixelbuf.PixelBuf):
|
|||
|
||||
n = int(len(mapping) / 3)
|
||||
|
||||
super().__init__(
|
||||
n, brightness=brightness, byteorder=pixel_order, auto_write=auto_write
|
||||
)
|
||||
super().__init__(n, brightness=brightness, byteorder=pixel_order, auto_write=auto_write)
|
||||
|
||||
self.is31fl3741 = is31
|
||||
self.addr = addr
|
||||
|
|
|
|||
|
|
@ -27,12 +27,12 @@ Implementation Notes
|
|||
"""
|
||||
|
||||
# imports
|
||||
from adafruit_is31fl3741 import _IS3741_ADDR_DEFAULT, NO_BUFFER, IS3741_BGR
|
||||
from adafruit_is31fl3741 import IS31FL3741_colorXY
|
||||
from adafruit_is31fl3741 import _IS3741_ADDR_DEFAULT, IS3741_BGR, NO_BUFFER, IS31FL3741_colorXY
|
||||
|
||||
try:
|
||||
# Used only for typing
|
||||
from typing import Tuple # pylint: disable=unused-import
|
||||
from typing import Tuple
|
||||
|
||||
import busio
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
"""
|
||||
LED Animation compatibility layer.
|
||||
"""
|
||||
|
||||
import array
|
||||
|
||||
|
||||
|
|
@ -13,7 +14,6 @@ def _int_as_tuple(value):
|
|||
|
||||
|
||||
def _setup_pixels(grid, led_glasses, left, left_start, right, right_start):
|
||||
# pylint: disable=too-many-locals, too-many-arguments
|
||||
left_right_size = 24
|
||||
order = [
|
||||
(left, "l", led_glasses.left_ring),
|
||||
|
|
@ -54,16 +54,13 @@ class LED_Glasses_Animation:
|
|||
left_start=21,
|
||||
right_start=8,
|
||||
):
|
||||
# pylint: disable=too-many-arguments
|
||||
self._glasses = led_glasses
|
||||
|
||||
# improvements:
|
||||
# Over, Under, Overlap, Not.
|
||||
# Left Start, Right Start, Grid Order
|
||||
|
||||
sequence = _setup_pixels(
|
||||
grid, led_glasses, left, left_start, right, right_start
|
||||
)
|
||||
sequence = _setup_pixels(grid, led_glasses, left, left_start, right, right_start)
|
||||
|
||||
self.brightness = brightness
|
||||
self.auto_write = auto_write
|
||||
|
|
@ -105,9 +102,7 @@ class LED_Glasses_Animation:
|
|||
if isinstance(key, slice):
|
||||
for idx, val in zip(self._range_for_slice(key), value):
|
||||
r, g, b = self._map_pixel(idx)
|
||||
self._glasses[r], self._glasses[g], self._glasses[b] = _int_as_tuple(
|
||||
val
|
||||
)
|
||||
self._glasses[r], self._glasses[g], self._glasses[b] = _int_as_tuple(val)
|
||||
return
|
||||
r, g, b = self._map_pixel(key)
|
||||
self._glasses[r], self._glasses[g], self._glasses[b] = _int_as_tuple(value)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
|
||||
.. If you created a package, create one automodule per module in the package.
|
||||
|
||||
API Reference
|
||||
#############
|
||||
|
||||
.. automodule:: adafruit_is31fl3741
|
||||
:members:
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
import datetime
|
||||
import os
|
||||
import sys
|
||||
import datetime
|
||||
|
||||
sys.path.insert(0, os.path.abspath(".."))
|
||||
|
||||
|
|
@ -49,9 +47,7 @@ project = "Adafruit IS31FL3741 Library"
|
|||
creation_year = "2021"
|
||||
current_year = str(datetime.datetime.now().year)
|
||||
year_duration = (
|
||||
current_year
|
||||
if current_year == creation_year
|
||||
else creation_year + " - " + current_year
|
||||
current_year if current_year == creation_year else creation_year + " - " + current_year
|
||||
)
|
||||
copyright = year_duration + " Ladyada"
|
||||
author = "Ladyada"
|
||||
|
|
|
|||
|
|
@ -3,8 +3,9 @@
|
|||
# Chaining 4 13x9 Matrix's to run sequentially (not simultaneously)
|
||||
|
||||
import board
|
||||
from adafruit_led_animation.sequence import AnimationSequence
|
||||
from adafruit_led_animation.animation.rainbowchase import RainbowChase
|
||||
from adafruit_led_animation.sequence import AnimationSequence
|
||||
|
||||
from adafruit_is31fl3741 import PREFER_BUFFER
|
||||
from adafruit_is31fl3741.adafruit_rgbmatrixqt import Adafruit_RGBMatrixQT
|
||||
from adafruit_is31fl3741.is31fl3741_pixelbuf import IS31FL3741_PixelBuf
|
||||
|
|
@ -38,13 +39,11 @@ Matrix33.enable = True
|
|||
WIDTH = 13
|
||||
HEIGHT = 9
|
||||
LEDS_MAP = tuple(
|
||||
(
|
||||
address
|
||||
for y in range(HEIGHT)
|
||||
for x in range(WIDTH)
|
||||
for address in Adafruit_RGBMatrixQT.pixel_addrs(x, y)
|
||||
)
|
||||
)
|
||||
Matrix30_pixels = IS31FL3741_PixelBuf(Matrix30, LEDS_MAP, init=False, auto_write=False)
|
||||
Matrix30_chase = RainbowChase(Matrix30_pixels, speed=0.1, size=1, spacing=3, step=8)
|
||||
|
||||
|
|
|
|||
|
|
@ -23,8 +23,6 @@ pixels = LED_Glasses_Animation(glasses)
|
|||
anim1 = RainbowComet(pixels, 0.05, tail_length=24, ring=True)
|
||||
anim2 = Sparkle(pixels, 0.05, PURPLE)
|
||||
anim3 = ColorCycle(pixels, 0.03)
|
||||
group = AnimationSequence(
|
||||
anim1, anim2, anim3, advance_interval=4, auto_reset=True, auto_clear=True
|
||||
)
|
||||
group = AnimationSequence(anim1, anim2, anim3, advance_interval=4, auto_reset=True, auto_clear=True)
|
||||
while True:
|
||||
group.animate()
|
||||
|
|
|
|||
|
|
@ -3,8 +3,9 @@
|
|||
|
||||
import board
|
||||
from rainbowio import colorwheel
|
||||
from adafruit_is31fl3741.adafruit_ledglasses import LED_Glasses
|
||||
|
||||
import adafruit_is31fl3741
|
||||
from adafruit_is31fl3741.adafruit_ledglasses import LED_Glasses
|
||||
|
||||
i2c = board.I2C() # uses board.SCL and board.SDA
|
||||
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
|
||||
|
|
|
|||
|
|
@ -1,15 +1,16 @@
|
|||
# SPDX-FileCopyrightText: 2021 Mark Komus
|
||||
# SPDX-License-Identifier: MIT
|
||||
# Currently example only compatible with Adafruit LED Glasses Driver nRF52840
|
||||
import is31fl3741
|
||||
import displayio
|
||||
import framebufferio
|
||||
import board
|
||||
import busio
|
||||
from adafruit_display_text import label
|
||||
import displayio
|
||||
import framebufferio
|
||||
import is31fl3741
|
||||
from adafruit_bitmap_font import bitmap_font
|
||||
from adafruit_led_animation.animation.comet import Comet
|
||||
from adafruit_display_text import label
|
||||
from adafruit_led_animation.animation.chase import Chase
|
||||
from adafruit_led_animation.animation.comet import Comet
|
||||
|
||||
from adafruit_is31fl3741.is31fl3741_PixelBuf import IS31FL3741_PixelBuf
|
||||
from adafruit_is31fl3741.led_glasses_map import (
|
||||
glassesmatrix_ledmap_no_ring,
|
||||
|
|
@ -41,12 +42,8 @@ display = framebufferio.FramebufferDisplay(is31_fb, auto_refresh=True)
|
|||
is31_fb.brightness = 0.1
|
||||
|
||||
# Create pixel buffers for each eye. Init is False as the display setup initialized the chip
|
||||
eye_left = IS31FL3741_PixelBuf(
|
||||
is31, left_ring_map_no_inner, init=False, auto_write=False
|
||||
)
|
||||
eye_right = IS31FL3741_PixelBuf(
|
||||
is31, right_ring_map_no_inner, init=False, auto_write=False
|
||||
)
|
||||
eye_left = IS31FL3741_PixelBuf(is31, left_ring_map_no_inner, init=False, auto_write=False)
|
||||
eye_right = IS31FL3741_PixelBuf(is31, right_ring_map_no_inner, init=False, auto_write=False)
|
||||
|
||||
# Create a different animation for each eye ring
|
||||
chase = Chase(eye_left, speed=0.05, color=(0, 0, 150), size=8, spacing=4)
|
||||
|
|
|
|||
|
|
@ -5,22 +5,24 @@
|
|||
This example repeatedly displays all available animations
|
||||
on the IS31FL3741 13x9 RGB Matrix, at a five second interval.
|
||||
"""
|
||||
|
||||
import board
|
||||
from adafruit_led_animation.animation.blink import Blink
|
||||
from adafruit_led_animation.animation.sparklepulse import SparklePulse
|
||||
from adafruit_led_animation.animation.comet import Comet
|
||||
from adafruit_led_animation.animation.chase import Chase
|
||||
from adafruit_led_animation.animation.pulse import Pulse
|
||||
from adafruit_led_animation.animation.sparkle import Sparkle
|
||||
from adafruit_led_animation.animation.rainbowchase import RainbowChase
|
||||
from adafruit_led_animation.animation.rainbowsparkle import RainbowSparkle
|
||||
from adafruit_led_animation.animation.rainbowcomet import RainbowComet
|
||||
from adafruit_led_animation.animation.solid import Solid
|
||||
from adafruit_led_animation.animation.colorcycle import ColorCycle
|
||||
from adafruit_led_animation.animation.rainbow import Rainbow
|
||||
from adafruit_led_animation.animation.comet import Comet
|
||||
from adafruit_led_animation.animation.customcolorchase import CustomColorChase
|
||||
from adafruit_led_animation.animation.pulse import Pulse
|
||||
from adafruit_led_animation.animation.rainbow import Rainbow
|
||||
from adafruit_led_animation.animation.rainbowchase import RainbowChase
|
||||
from adafruit_led_animation.animation.rainbowcomet import RainbowComet
|
||||
from adafruit_led_animation.animation.rainbowsparkle import RainbowSparkle
|
||||
from adafruit_led_animation.animation.solid import Solid
|
||||
from adafruit_led_animation.animation.sparkle import Sparkle
|
||||
from adafruit_led_animation.animation.sparklepulse import SparklePulse
|
||||
from adafruit_led_animation.color import AMBER, JADE, MAGENTA, ORANGE, PURPLE, WHITE
|
||||
from adafruit_led_animation.sequence import AnimationSequence
|
||||
from adafruit_led_animation.color import PURPLE, WHITE, AMBER, JADE, MAGENTA, ORANGE
|
||||
|
||||
from adafruit_is31fl3741 import PREFER_BUFFER
|
||||
from adafruit_is31fl3741.adafruit_rgbmatrixqt import Adafruit_RGBMatrixQT
|
||||
from adafruit_is31fl3741.is31fl3741_pixelbuf import IS31FL3741_PixelBuf
|
||||
|
|
@ -44,13 +46,11 @@ is31.enable = True
|
|||
WIDTH = 13
|
||||
HEIGHT = 9
|
||||
LEDS_MAP = tuple(
|
||||
(
|
||||
address
|
||||
for y in range(HEIGHT)
|
||||
for x in range(WIDTH)
|
||||
for address in Adafruit_RGBMatrixQT.pixel_addrs(x, y)
|
||||
)
|
||||
)
|
||||
pixels = IS31FL3741_PixelBuf(is31, LEDS_MAP, init=False, auto_write=False)
|
||||
|
||||
########################################################################
|
||||
|
|
|
|||
|
|
@ -5,12 +5,14 @@
|
|||
This example repeatedly displays all available animations
|
||||
on the IS31FL3741 13x9 RGB Matrix, at a five second interval.
|
||||
"""
|
||||
|
||||
import board
|
||||
from adafruit_led_animation.animation.blink import Blink
|
||||
from adafruit_led_animation.animation.comet import Comet
|
||||
from adafruit_led_animation.animation.colorcycle import ColorCycle
|
||||
from adafruit_led_animation.animation.comet import Comet
|
||||
from adafruit_led_animation.color import JADE, PURPLE
|
||||
from adafruit_led_animation.sequence import AnimationSequence
|
||||
from adafruit_led_animation.color import PURPLE, JADE
|
||||
|
||||
from adafruit_is31fl3741 import PREFER_BUFFER
|
||||
from adafruit_is31fl3741.adafruit_rgbmatrixqt import Adafruit_RGBMatrixQT
|
||||
from adafruit_is31fl3741.is31fl3741_pixelbuf import IS31FL3741_PixelBuf
|
||||
|
|
@ -34,13 +36,11 @@ is31.enable = True
|
|||
WIDTH = 13
|
||||
HEIGHT = 9
|
||||
LEDS_MAP = tuple(
|
||||
(
|
||||
address
|
||||
for y in range(HEIGHT)
|
||||
for x in range(WIDTH)
|
||||
for address in Adafruit_RGBMatrixQT.pixel_addrs(x, y)
|
||||
)
|
||||
)
|
||||
pixels = IS31FL3741_PixelBuf(is31, LEDS_MAP, init=False, auto_write=False)
|
||||
|
||||
########################################################################
|
||||
|
|
|
|||
|
|
@ -5,14 +5,15 @@
|
|||
This example repeatedly displays all available animations
|
||||
on the IS31FL3741 13x9 RGB Matrix, at a five second interval.
|
||||
"""
|
||||
|
||||
import board
|
||||
from adafruit_led_animation.animation.blink import Blink
|
||||
from adafruit_led_animation.color import PINK
|
||||
|
||||
from adafruit_is31fl3741 import PREFER_BUFFER
|
||||
from adafruit_is31fl3741.adafruit_rgbmatrixqt import Adafruit_RGBMatrixQT
|
||||
from adafruit_is31fl3741.is31fl3741_pixelbuf import IS31FL3741_PixelBuf
|
||||
|
||||
|
||||
# i2c = board.I2C()
|
||||
i2c = board.STEMMA_I2C()
|
||||
|
||||
|
|
@ -32,13 +33,11 @@ is31.enable = True
|
|||
WIDTH = 13
|
||||
HEIGHT = 9
|
||||
LEDS_MAP = tuple(
|
||||
(
|
||||
address
|
||||
for y in range(HEIGHT)
|
||||
for x in range(WIDTH)
|
||||
for address in Adafruit_RGBMatrixQT.pixel_addrs(x, y)
|
||||
)
|
||||
)
|
||||
pixels = IS31FL3741_PixelBuf(is31, LEDS_MAP, init=False, auto_write=False)
|
||||
|
||||
########################################################################
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
import board
|
||||
from rainbowio import colorwheel
|
||||
|
||||
from adafruit_is31fl3741.adafruit_rgbmatrixqt import Adafruit_RGBMatrixQT
|
||||
import adafruit_is31fl3741
|
||||
from adafruit_is31fl3741.adafruit_rgbmatrixqt import Adafruit_RGBMatrixQT
|
||||
|
||||
i2c = board.I2C() # uses board.SCL and board.SDA
|
||||
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
|
||||
import time
|
||||
|
||||
import board
|
||||
|
||||
import adafruit_is31fl3741
|
||||
|
||||
i2c = board.I2C() # uses board.SCL and board.SDA
|
||||
|
|
|
|||
105
ruff.toml
Normal file
105
ruff.toml
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
# SPDX-FileCopyrightText: 2024 Tim Cocks for Adafruit Industries
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
target-version = "py38"
|
||||
line-length = 100
|
||||
|
||||
[lint]
|
||||
preview = true
|
||||
select = ["I", "PL", "UP"]
|
||||
|
||||
extend-select = [
|
||||
"D419", # empty-docstring
|
||||
"E501", # line-too-long
|
||||
"W291", # trailing-whitespace
|
||||
"PLC0414", # useless-import-alias
|
||||
"PLC2401", # non-ascii-name
|
||||
"PLC2801", # unnecessary-dunder-call
|
||||
"PLC3002", # unnecessary-direct-lambda-call
|
||||
"E999", # syntax-error
|
||||
"PLE0101", # return-in-init
|
||||
"F706", # return-outside-function
|
||||
"F704", # yield-outside-function
|
||||
"PLE0116", # continue-in-finally
|
||||
"PLE0117", # nonlocal-without-binding
|
||||
"PLE0241", # duplicate-bases
|
||||
"PLE0302", # unexpected-special-method-signature
|
||||
"PLE0604", # invalid-all-object
|
||||
"PLE0605", # invalid-all-format
|
||||
"PLE0643", # potential-index-error
|
||||
"PLE0704", # misplaced-bare-raise
|
||||
"PLE1141", # dict-iter-missing-items
|
||||
"PLE1142", # await-outside-async
|
||||
"PLE1205", # logging-too-many-args
|
||||
"PLE1206", # logging-too-few-args
|
||||
"PLE1307", # bad-string-format-type
|
||||
"PLE1310", # bad-str-strip-call
|
||||
"PLE1507", # invalid-envvar-value
|
||||
"PLE2502", # bidirectional-unicode
|
||||
"PLE2510", # invalid-character-backspace
|
||||
"PLE2512", # invalid-character-sub
|
||||
"PLE2513", # invalid-character-esc
|
||||
"PLE2514", # invalid-character-nul
|
||||
"PLE2515", # invalid-character-zero-width-space
|
||||
"PLR0124", # comparison-with-itself
|
||||
"PLR0202", # no-classmethod-decorator
|
||||
"PLR0203", # no-staticmethod-decorator
|
||||
"UP004", # useless-object-inheritance
|
||||
"PLR0206", # property-with-parameters
|
||||
"PLR0904", # too-many-public-methods
|
||||
"PLR0911", # too-many-return-statements
|
||||
"PLR0912", # too-many-branches
|
||||
"PLR0913", # too-many-arguments
|
||||
"PLR0914", # too-many-locals
|
||||
"PLR0915", # too-many-statements
|
||||
"PLR0916", # too-many-boolean-expressions
|
||||
"PLR1702", # too-many-nested-blocks
|
||||
"PLR1704", # redefined-argument-from-local
|
||||
"PLR1711", # useless-return
|
||||
"C416", # unnecessary-comprehension
|
||||
"PLR1733", # unnecessary-dict-index-lookup
|
||||
"PLR1736", # unnecessary-list-index-lookup
|
||||
|
||||
# ruff reports this rule is unstable
|
||||
#"PLR6301", # no-self-use
|
||||
|
||||
"PLW0108", # unnecessary-lambda
|
||||
"PLW0120", # useless-else-on-loop
|
||||
"PLW0127", # self-assigning-variable
|
||||
"PLW0129", # assert-on-string-literal
|
||||
"B033", # duplicate-value
|
||||
"PLW0131", # named-expr-without-context
|
||||
"PLW0245", # super-without-brackets
|
||||
"PLW0406", # import-self
|
||||
"PLW0602", # global-variable-not-assigned
|
||||
"PLW0603", # global-statement
|
||||
"PLW0604", # global-at-module-level
|
||||
|
||||
# fails on the try: import typing used by libraries
|
||||
#"F401", # unused-import
|
||||
|
||||
"F841", # unused-variable
|
||||
"E722", # bare-except
|
||||
"PLW0711", # binary-op-exception
|
||||
"PLW1501", # bad-open-mode
|
||||
"PLW1508", # invalid-envvar-default
|
||||
"PLW1509", # subprocess-popen-preexec-fn
|
||||
"PLW2101", # useless-with-lock
|
||||
"PLW3301", # nested-min-max
|
||||
]
|
||||
|
||||
ignore = [
|
||||
"PLR2004", # magic-value-comparison
|
||||
"UP030", # format literals
|
||||
"PLW1514", # unspecified-encoding
|
||||
"PLR0913", # too-many-arguments
|
||||
"PLR0915", # too-many-statements
|
||||
"PLR0917", # too-many-positional-arguments
|
||||
"PLR0904", # too-many-public-methods
|
||||
"PLR0912", # too-many-branches
|
||||
"PLR0916", # too-many-boolean-expressions
|
||||
]
|
||||
|
||||
[format]
|
||||
line-ending = "lf"
|
||||
Loading…
Reference in a new issue