diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..21c125c --- /dev/null +++ b/.gitattributes @@ -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 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 70ade69..ff19dde 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 diff --git a/.pylintrc b/.pylintrc deleted file mode 100644 index f945e92..0000000 --- a/.pylintrc +++ /dev/null @@ -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*(# )??$ - -# 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 diff --git a/README.rst b/README.rst index 79ac43f..01b958a 100644 --- a/README.rst +++ b/README.rst @@ -17,9 +17,9 @@ Introduction :alt: Build Status -.. image:: https://img.shields.io/badge/code%20style-black-000000.svg - :target: https://github.com/psf/black - :alt: Code Style: Black +.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json + :target: https://github.com/astral-sh/ruff + :alt: Code Style: Ruff Portal Style Library for the Adafruit Qualia ESP32-S3 diff --git a/adafruit_qualia/__init__.py b/adafruit_qualia/__init__.py index 803f31d..1bb7e90 100755 --- a/adafruit_qualia/__init__.py +++ b/adafruit_qualia/__init__.py @@ -28,13 +28,15 @@ """ import gc + from adafruit_portalbase import PortalBase -from .network import Network + from .graphics import Graphics +from .network import Network from .peripherals import Peripherals try: - from typing import Optional, Dict, Union, Callable, Sequence, List + from typing import Callable, Dict, List, Optional, Sequence, Union except ImportError: pass @@ -67,7 +69,6 @@ class Qualia(PortalBase): """ - # pylint: disable=too-few-public-methods def __init__( self, display_type: str, @@ -81,7 +82,7 @@ def __init__( rotation: int = 0, scale: int = 1, debug: bool = False, - use_network: bool = True + use_network: bool = True, ) -> None: if use_network: network = Network( diff --git a/adafruit_qualia/displays/__init__.py b/adafruit_qualia/displays/__init__.py index 310d88c..484714d 100755 --- a/adafruit_qualia/displays/__init__.py +++ b/adafruit_qualia/displays/__init__.py @@ -13,15 +13,17 @@ * Author(s): Melissa LeBlanc-Williams """ + import time -import busio + import board -import espidf +import busio import dotclockframebuffer -from framebufferio import FramebufferDisplay -from displayio import release_displays -from adafruit_focaltouch import Adafruit_FocalTouch +import espidf from adafruit_cst8xx import Adafruit_CST8XX +from adafruit_focaltouch import Adafruit_FocalTouch +from displayio import release_displays +from framebufferio import FramebufferDisplay TOUCH_FOCALTOUCH = Adafruit_FocalTouch TOUCH_CST826 = Adafruit_CST8XX @@ -35,7 +37,7 @@ class DotClockDisplay: def __init__(self): release_displays() board.I2C().deinit() - self._init_sequence = bytes() + self._init_sequence = b"" self._timings = {} self._bus_frequency = 100_000 self._touch_driver = TOUCH_FOCALTOUCH diff --git a/adafruit_qualia/displays/bar240x960.py b/adafruit_qualia/displays/bar240x960.py index 02b57e4..2ec8c7e 100755 --- a/adafruit_qualia/displays/bar240x960.py +++ b/adafruit_qualia/displays/bar240x960.py @@ -31,53 +31,51 @@ class Bar240x960(DotClockDisplay): def __init__(self): super().__init__() self._init_sequence = bytes( - ( - b"\xff\x05w\x01\x00\x00\x13" - b"\xef\x01\x08" - b"\xff\x05w\x01\x00\x00\x10" - b"\xc0\x02w\x00" - b"\xc1\x02\x11\x0c" - b"\xc2\x02\x07\x02" - b"\xcc\x010" - b"\xb0\x10\x06\xcf\x14\x0c\x0f\x03\x00\n\x07\x1b\x03\x12\x10%6\x1e" - b"\xb1\x10\x0c\xd4\x18\x0c\x0e\x06\x03\x06\x08#\x06\x12\x100/\x1f" - b"\xff\x05w\x01\x00\x00\x11" - b"\xb0\x01s" - b"\xb1\x01|" - b"\xb2\x01\x83" - b"\xb3\x01\x80" - b"\xb5\x01I" - b"\xb7\x01\x87" - b"\xb8\x013" - b"\xb9\x02\x10\x1f" - b"\xbb\x01\x03" - b"\xc1\x01\x08" - b"\xc2\x01\x08" - b"\xd0\x01\x88" - b"\xe0\x06\x00\x00\x02\x00\x00\x0c" - b"\xe1\x0b\x05\x96\x07\x96\x06\x96\x08\x96\x00DD" - b"\xe2\x0c\x00\x00\x03\x03\x00\x00\x02\x00\x00\x00\x02\x00" - b"\xe3\x04\x00\x0033" - b"\xe4\x02DD" - b"\xe5\x10\r\xd4(\x8c\x0f\xd6(\x8c\t\xd0(\x8c\x0b\xd2(\x8c" - b"\xe6\x04\x00\x0033" - b"\xe7\x02DD" - b"\xe8\x10\x0e\xd5(\x8c\x10\xd7(\x8c\n\xd1(\x8c\x0c\xd3(\x8c" - b"\xeb\x06\x00\x01\xe4\xe4D\x00" - b"\xed\x10\xf3\xc1\xba\x0ffwDUUDwf\xf0\xab\x1c?" - b"\xef\x06\x10\r\x04\x08?\x1f" - b"\xff\x05w\x01\x00\x00\x13" - b"\xe8\x02\x00\x0e" - b"\x11\x80x" - b"\xe8\x82\x00\x0c\n" - b"\xe8\x02@\x00" - b"\xff\x05w\x01\x00\x00\x00" - b"6\x01\x00" - b":\x01f" - b")\x80\x14" - b"\xff\x05w\x01\x00\x00\x10" - b"\xe5\x02\x00\x00" - ) + b"\xff\x05w\x01\x00\x00\x13" + b"\xef\x01\x08" + b"\xff\x05w\x01\x00\x00\x10" + b"\xc0\x02w\x00" + b"\xc1\x02\x11\x0c" + b"\xc2\x02\x07\x02" + b"\xcc\x010" + b"\xb0\x10\x06\xcf\x14\x0c\x0f\x03\x00\n\x07\x1b\x03\x12\x10%6\x1e" + b"\xb1\x10\x0c\xd4\x18\x0c\x0e\x06\x03\x06\x08#\x06\x12\x100/\x1f" + b"\xff\x05w\x01\x00\x00\x11" + b"\xb0\x01s" + b"\xb1\x01|" + b"\xb2\x01\x83" + b"\xb3\x01\x80" + b"\xb5\x01I" + b"\xb7\x01\x87" + b"\xb8\x013" + b"\xb9\x02\x10\x1f" + b"\xbb\x01\x03" + b"\xc1\x01\x08" + b"\xc2\x01\x08" + b"\xd0\x01\x88" + b"\xe0\x06\x00\x00\x02\x00\x00\x0c" + b"\xe1\x0b\x05\x96\x07\x96\x06\x96\x08\x96\x00DD" + b"\xe2\x0c\x00\x00\x03\x03\x00\x00\x02\x00\x00\x00\x02\x00" + b"\xe3\x04\x00\x0033" + b"\xe4\x02DD" + b"\xe5\x10\r\xd4(\x8c\x0f\xd6(\x8c\t\xd0(\x8c\x0b\xd2(\x8c" + b"\xe6\x04\x00\x0033" + b"\xe7\x02DD" + b"\xe8\x10\x0e\xd5(\x8c\x10\xd7(\x8c\n\xd1(\x8c\x0c\xd3(\x8c" + b"\xeb\x06\x00\x01\xe4\xe4D\x00" + b"\xed\x10\xf3\xc1\xba\x0ffwDUUDwf\xf0\xab\x1c?" + b"\xef\x06\x10\r\x04\x08?\x1f" + b"\xff\x05w\x01\x00\x00\x13" + b"\xe8\x02\x00\x0e" + b"\x11\x80x" + b"\xe8\x82\x00\x0c\n" + b"\xe8\x02@\x00" + b"\xff\x05w\x01\x00\x00\x00" + b"6\x01\x00" + b":\x01f" + b")\x80\x14" + b"\xff\x05w\x01\x00\x00\x10" + b"\xe5\x02\x00\x00" ) self._timings = { diff --git a/adafruit_qualia/displays/bar320x820.py b/adafruit_qualia/displays/bar320x820.py index 8425180..f009a73 100755 --- a/adafruit_qualia/displays/bar320x820.py +++ b/adafruit_qualia/displays/bar320x820.py @@ -34,56 +34,54 @@ def __init__(self): super().__init__() self._bus_frequency = 400_000 self._init_sequence = bytes( - ( - b"\x11\x80d" - b"\xff\x05w\x01\x00\x00\x13" - b"\xef\x01\x08" - b"\xff\x05w\x01\x00\x00\x10" - b"\xc0\x02\xe5\x02" - b"\xc1\x02\x0c\n" - b"\xc2\x02\x07\x0f" - b"\xc3\x01\x02" - b"\xcc\x01\x10" - b"\xcd\x01\x08" - b"\xb0\x10\x00\x08Q\r\xce\x06\x00\x08\x08\x1d\x02\xd0\x0fo6?" - b"\xb1\x10\x00\x10O\x0c\x11\x05\x00\x07\x07\x1f\x05\xd3\x11n4?" - b"\xff\x05w\x01\x00\x00\x11" - b"\xb0\x01M" - b"\xb1\x01\x1c" - b"\xb2\x01\x87" - b"\xb3\x01\x80" - b"\xb5\x01G" - b"\xb7\x01\x85" - b"\xb8\x01!" - b"\xb9\x01\x10" - b"\xc1\x01x" - b"\xc2\x01x" - b"\xd0\x81\x88d" - b"\xe0\x03\x80\x00\x02" - b"\xe1\x0b\x04\xa0\x00\x00\x05\xa0\x00\x00\x00``" - b"\xe2\r00``<\xa0\x00\x00=\xa0\x00\x00\x00" - b"\xe3\x04\x00\x0033" - b"\xe4\x02DD" - b"\xe5\x10\x06>\xa0\xa0\x08@\xa0\xa0\nB\xa0\xa0\x0cD\xa0\xa0" - b"\xe6\x04\x00\x0033" - b"\xe7\x02DD" - b"\xe8\x10\x07?\xa0\xa0\tA\xa0\xa0\x0bC\xa0\xa0\rE\xa0\xa0" - b"\xeb\x07\x00\x01NN\xeeD\x00" - b"\xed\x10\xff\xff\x04Vr\xff\xff\xff\xff\xff\xff'e@\xff\xff" - b"\xef\x06\x10\r\x04\x08?\x1f" - b"\xff\x05w\x01\x00\x00\x13" - b"\xe8\x02\x00\x0e" - b"\xff\x05w\x01\x00\x00\x00" - b"\x11\x80x" - b"\xff\x05w\x01\x00\x00\x13" - b"\xe8\x82\x00\x0c\n" - b"\xe8\x02\x00\x00" - b"\xff\x05w\x01\x00\x00\x00" - b"6\x01\x00" - b":\x01f" - b"\x11\x80x" - b")\x80x" - ) + b"\x11\x80d" + b"\xff\x05w\x01\x00\x00\x13" + b"\xef\x01\x08" + b"\xff\x05w\x01\x00\x00\x10" + b"\xc0\x02\xe5\x02" + b"\xc1\x02\x0c\n" + b"\xc2\x02\x07\x0f" + b"\xc3\x01\x02" + b"\xcc\x01\x10" + b"\xcd\x01\x08" + b"\xb0\x10\x00\x08Q\r\xce\x06\x00\x08\x08\x1d\x02\xd0\x0fo6?" + b"\xb1\x10\x00\x10O\x0c\x11\x05\x00\x07\x07\x1f\x05\xd3\x11n4?" + b"\xff\x05w\x01\x00\x00\x11" + b"\xb0\x01M" + b"\xb1\x01\x1c" + b"\xb2\x01\x87" + b"\xb3\x01\x80" + b"\xb5\x01G" + b"\xb7\x01\x85" + b"\xb8\x01!" + b"\xb9\x01\x10" + b"\xc1\x01x" + b"\xc2\x01x" + b"\xd0\x81\x88d" + b"\xe0\x03\x80\x00\x02" + b"\xe1\x0b\x04\xa0\x00\x00\x05\xa0\x00\x00\x00``" + b"\xe2\r00``<\xa0\x00\x00=\xa0\x00\x00\x00" + b"\xe3\x04\x00\x0033" + b"\xe4\x02DD" + b"\xe5\x10\x06>\xa0\xa0\x08@\xa0\xa0\nB\xa0\xa0\x0cD\xa0\xa0" + b"\xe6\x04\x00\x0033" + b"\xe7\x02DD" + b"\xe8\x10\x07?\xa0\xa0\tA\xa0\xa0\x0bC\xa0\xa0\rE\xa0\xa0" + b"\xeb\x07\x00\x01NN\xeeD\x00" + b"\xed\x10\xff\xff\x04Vr\xff\xff\xff\xff\xff\xff'e@\xff\xff" + b"\xef\x06\x10\r\x04\x08?\x1f" + b"\xff\x05w\x01\x00\x00\x13" + b"\xe8\x02\x00\x0e" + b"\xff\x05w\x01\x00\x00\x00" + b"\x11\x80x" + b"\xff\x05w\x01\x00\x00\x13" + b"\xe8\x82\x00\x0c\n" + b"\xe8\x02\x00\x00" + b"\xff\x05w\x01\x00\x00\x00" + b"6\x01\x00" + b":\x01f" + b"\x11\x80x" + b")\x80x" ) self._timings = { diff --git a/adafruit_qualia/displays/bar320x960.py b/adafruit_qualia/displays/bar320x960.py index 66bbde0..8046c2f 100755 --- a/adafruit_qualia/displays/bar320x960.py +++ b/adafruit_qualia/displays/bar320x960.py @@ -31,47 +31,45 @@ class Bar320x960(DotClockDisplay): def __init__(self): super().__init__() self._init_sequence = bytes( - ( - b"\xff\x05w\x01\x00\x00\x13" - b"\xef\x01\x08" - b"\xff\x05w\x01\x00\x00\x10" - b"\xc0\x02w\x00" - b"\xc1\x02\t\x08" - b"\xc2\x02\x01\x02" - b"\xc3\x01\x02" - b"\xcc\x01\x10" - b"\xb0\x10@\x14Y\x10\x12\x08\x03\t\x05\x1e\x05\x14\x10h3\x15" - b"\xb1\x10@\x08S\t\x11\t\x02\x07\t\x1a\x04\x12\x12d))" - b"\xff\x05w\x01\x00\x00\x11" - b"\xb0\x01m" - b"\xb1\x01\x1d" - b"\xb2\x01\x87" - b"\xb3\x01\x80" - b"\xb5\x01I" - b"\xb7\x01\x85" - b"\xb8\x01 " - b"\xc1\x01x" - b"\xc2\x01x" - b"\xd0\x01\x88" - b"\xe0\x03\x00\x00\x02" - b"\xe1\x0b\x02\x8c\x00\x00\x03\x8c\x00\x00\x0033" - b"\xe2\r3333\xc9<\x00\x00\xca<\x00\x00\x00" - b"\xe3\x04\x00\x0033" - b"\xe4\x02DD" - b"\xe5\x10\x05\xcd\x82\x82\x01\xc9\x82\x82\x07\xcf\x82\x82\x03\xcb\x82\x82" - b"\xe6\x04\x00\x0033" - b"\xe7\x02DD" - b"\xe8\x10\x06\xce\x82\x82\x02\xca\x82\x82\x08\xd0\x82\x82\x04\xcc\x82\x82" - b"\xeb\x07\x08\x01\xe4\xe4\x88\x00@" - b"\xec\x03\x00\x00\x00" - b"\xed\x10\xff\xf0\x07eO\xfc\xc2/\xf2,\xcf\xf4Vp\x0f\xff" - b"\xef\x06\x10\r\x04\x08?\x1f" - b"\xff\x05w\x01\x00\x00\x00" - b"\x11\x80x" - b"5\x01\x00" - b":\x81fd" - b")\x00" - ) + b"\xff\x05w\x01\x00\x00\x13" + b"\xef\x01\x08" + b"\xff\x05w\x01\x00\x00\x10" + b"\xc0\x02w\x00" + b"\xc1\x02\t\x08" + b"\xc2\x02\x01\x02" + b"\xc3\x01\x02" + b"\xcc\x01\x10" + b"\xb0\x10@\x14Y\x10\x12\x08\x03\t\x05\x1e\x05\x14\x10h3\x15" + b"\xb1\x10@\x08S\t\x11\t\x02\x07\t\x1a\x04\x12\x12d))" + b"\xff\x05w\x01\x00\x00\x11" + b"\xb0\x01m" + b"\xb1\x01\x1d" + b"\xb2\x01\x87" + b"\xb3\x01\x80" + b"\xb5\x01I" + b"\xb7\x01\x85" + b"\xb8\x01 " + b"\xc1\x01x" + b"\xc2\x01x" + b"\xd0\x01\x88" + b"\xe0\x03\x00\x00\x02" + b"\xe1\x0b\x02\x8c\x00\x00\x03\x8c\x00\x00\x0033" + b"\xe2\r3333\xc9<\x00\x00\xca<\x00\x00\x00" + b"\xe3\x04\x00\x0033" + b"\xe4\x02DD" + b"\xe5\x10\x05\xcd\x82\x82\x01\xc9\x82\x82\x07\xcf\x82\x82\x03\xcb\x82\x82" + b"\xe6\x04\x00\x0033" + b"\xe7\x02DD" + b"\xe8\x10\x06\xce\x82\x82\x02\xca\x82\x82\x08\xd0\x82\x82\x04\xcc\x82\x82" + b"\xeb\x07\x08\x01\xe4\xe4\x88\x00@" + b"\xec\x03\x00\x00\x00" + b"\xed\x10\xff\xf0\x07eO\xfc\xc2/\xf2,\xcf\xf4Vp\x0f\xff" + b"\xef\x06\x10\r\x04\x08?\x1f" + b"\xff\x05w\x01\x00\x00\x00" + b"\x11\x80x" + b"5\x01\x00" + b":\x81fd" + b")\x00" ) self._timings = { diff --git a/adafruit_qualia/displays/round21.py b/adafruit_qualia/displays/round21.py index 2867251..589552d 100755 --- a/adafruit_qualia/displays/round21.py +++ b/adafruit_qualia/displays/round21.py @@ -24,7 +24,7 @@ """ -from . import DotClockDisplay, TOUCH_CST826 +from . import TOUCH_CST826, DotClockDisplay class Round21(DotClockDisplay): diff --git a/adafruit_qualia/displays/round28.py b/adafruit_qualia/displays/round28.py index a6d6b06..1878625 100755 --- a/adafruit_qualia/displays/round28.py +++ b/adafruit_qualia/displays/round28.py @@ -31,49 +31,47 @@ class Round28(DotClockDisplay): def __init__(self): super().__init__() self._init_sequence = bytes( - ( - b"\xff\x05w\x01\x00\x00\x13" - b"\xef\x01\x08" - b"\xff\x05w\x01\x00\x00\x10" - b"\xc0\x02;\x00" - b"\xc1\x02\x10\x0c" - b"\xc2\x02\x07\n" - b"\xc7\x01\x00" - b"\xcc\x01\x10" - b"\xcd\x01\x08" - b"\xb0\x10\x05\x12\x98\x0e\x0f\x07\x07\t\t#\x05R\x0fg,\x11" - b'\xb1\x10\x0b\x11\x97\x0c\x12\x06\x06\x08\x08"\x03Q\x11f+\x0f' - b"\xff\x05w\x01\x00\x00\x11" - b"\xb0\x01]" - b"\xb1\x01-" - b"\xb2\x01\x81" - b"\xb3\x01\x80" - b"\xb5\x01N" - b"\xb7\x01\x85" - b"\xb8\x01 " - b"\xc1\x01x" - b"\xc2\x01x" - b"\xd0\x01\x88" - b"\xe0\x03\x00\x00\x02" - b"\xe1\x0b\x060\x080\x050\x070\x0033" - b"\xe2\x0c\x11\x1133\xf4\x00\x00\x00\xf4\x00\x00\x00" - b"\xe3\x04\x00\x00\x11\x11" - b"\xe4\x02DD" - b"\xe5\x10\r\xf50\xf0\x0f\xf70\xf0\t\xf10\xf0\x0b\xf30\xf0" - b"\xe6\x04\x00\x00\x11\x11" - b"\xe7\x02DD" - b"\xe8\x10\x0c\xf40\xf0\x0e\xf60\xf0\x08\xf00\xf0\n\xf20\xf0" - b"\xe9\x026\x01" - b"\xeb\x07\x00\x01\xe4\xe4D\x88@" - b"\xed\x10\xff\x10\xafvT+\xcf\xff\xff\xfc\xb2Eg\xfa\x01\xff" - b"\xef\x06\x08\x08\x08E?T" - b"\xff\x05w\x01\x00\x00\x00" - b"\x11\x80x" - b":\x01f" - b"6\x01\x00" - b"5\x01\x00" - b")\x802" - ) + b"\xff\x05w\x01\x00\x00\x13" + b"\xef\x01\x08" + b"\xff\x05w\x01\x00\x00\x10" + b"\xc0\x02;\x00" + b"\xc1\x02\x10\x0c" + b"\xc2\x02\x07\n" + b"\xc7\x01\x00" + b"\xcc\x01\x10" + b"\xcd\x01\x08" + b"\xb0\x10\x05\x12\x98\x0e\x0f\x07\x07\t\t#\x05R\x0fg,\x11" + b'\xb1\x10\x0b\x11\x97\x0c\x12\x06\x06\x08\x08"\x03Q\x11f+\x0f' + b"\xff\x05w\x01\x00\x00\x11" + b"\xb0\x01]" + b"\xb1\x01-" + b"\xb2\x01\x81" + b"\xb3\x01\x80" + b"\xb5\x01N" + b"\xb7\x01\x85" + b"\xb8\x01 " + b"\xc1\x01x" + b"\xc2\x01x" + b"\xd0\x01\x88" + b"\xe0\x03\x00\x00\x02" + b"\xe1\x0b\x060\x080\x050\x070\x0033" + b"\xe2\x0c\x11\x1133\xf4\x00\x00\x00\xf4\x00\x00\x00" + b"\xe3\x04\x00\x00\x11\x11" + b"\xe4\x02DD" + b"\xe5\x10\r\xf50\xf0\x0f\xf70\xf0\t\xf10\xf0\x0b\xf30\xf0" + b"\xe6\x04\x00\x00\x11\x11" + b"\xe7\x02DD" + b"\xe8\x10\x0c\xf40\xf0\x0e\xf60\xf0\x08\xf00\xf0\n\xf20\xf0" + b"\xe9\x026\x01" + b"\xeb\x07\x00\x01\xe4\xe4D\x88@" + b"\xed\x10\xff\x10\xafvT+\xcf\xff\xff\xfc\xb2Eg\xfa\x01\xff" + b"\xef\x06\x08\x08\x08E?T" + b"\xff\x05w\x01\x00\x00\x00" + b"\x11\x80x" + b":\x01f" + b"6\x01\x00" + b"5\x01\x00" + b")\x802" ) self._timings = { diff --git a/adafruit_qualia/displays/round40.py b/adafruit_qualia/displays/round40.py index e088e50..603df69 100755 --- a/adafruit_qualia/displays/round40.py +++ b/adafruit_qualia/displays/round40.py @@ -31,164 +31,162 @@ class Round40(DotClockDisplay): def __init__(self): super().__init__() self._init_sequence = bytes( - ( - b"\xff\x010" - b"\xff\x01R" - b"\xff\x01\x01" - b"\xe3\x01\x00" - b"\n\x01\x11" - b"#\x01\xa0" - b"$\x012" - b"%\x01\x12" - b"&\x01." - b"'\x01." - b")\x01\x02" - b"*\x01\xcf" - b"2\x014" - b"8\x01\x9c" - b"9\x01\xa7" - b":\x01'" - b";\x01\x94" - b"B\x01m" - b"C\x01\x83" - b"\x81\x01\x00" - b"\x91\x01g" - b"\x92\x01g" - b"\xa0\x01R" - b"\xa1\x01P" - b"\xa4\x01\x9c" - b"\xa7\x01\x02" - b"\xa8\x01\x02" - b"\xa9\x01\x02" - b"\xaa\x01\xa8" - b"\xab\x01(" - b"\xae\x01\xd2" - b"\xaf\x01\x02" - b"\xb0\x01\xd2" - b"\xb2\x01&" - b"\xb3\x01&" - b"\xff\x010" - b"\xff\x01R" - b"\xff\x01\x02" - b"\xb1\x01\n" - b"\xd1\x01\x0e" - b"\xb4\x01/" - b"\xd4\x01-" - b"\xb2\x01\x0c" - b"\xd2\x01\x0c" - b"\xb3\x010" - b"\xd3\x01*" - b"\xb6\x01\x1e" - b"\xd6\x01\x16" - b"\xb7\x01;" - b"\xd7\x015" - b"\xc1\x01\x08" - b"\xe1\x01\x08" - b"\xb8\x01\r" - b"\xd8\x01\r" - b"\xb9\x01\x05" - b"\xd9\x01\x05" - b"\xbd\x01\x15" - b"\xdd\x01\x15" - b"\xbc\x01\x13" - b"\xdc\x01\x13" - b"\xbb\x01\x12" - b"\xdb\x01\x10" - b"\xba\x01\x11" - b"\xda\x01\x11" - b"\xbe\x01\x17" - b"\xde\x01\x17" - b"\xbf\x01\x0f" - b"\xdf\x01\x0f" - b"\xc0\x01\x16" - b"\xe0\x01\x16" - b"\xb5\x01." - b"\xd5\x01?" - b"\xb0\x01\x03" - b"\xd0\x01\x02" - b"\xff\x010" - b"\xff\x01R" - b"\xff\x01\x03" - b"\x08\x01\t" - b"\t\x01\n" - b"\n\x01\x0b" - b"\x0b\x01\x0c" - b'(\x01"' - b"*\x01\xe9" - b"+\x01\xe9" - b"4\x01Q" - b"5\x01\x01" - b"6\x01&" - b"7\x01\x13" - b"@\x01\x07" - b"A\x01\x08" - b"B\x01\t" - b"C\x01\n" - b'D\x01"' - b"E\x01\xdb" - b"F\x01\xdc" - b'G\x01"' - b"H\x01\xdd" - b"I\x01\xde" - b"P\x01\x0b" - b"Q\x01\x0c" - b"R\x01\r" - b"S\x01\x0e" - b'T\x01"' - b"U\x01\xdf" - b"V\x01\xe0" - b'W\x01"' - b"X\x01\xe1" - b"Y\x01\xe2" - b"\x80\x01\x1e" - b"\x81\x01\x1e" - b"\x82\x01\x1f" - b"\x83\x01\x1f" - b"\x84\x01\x05" - b"\x85\x01\n" - b"\x86\x01\n" - b"\x87\x01\x0c" - b"\x88\x01\x0c" - b"\x89\x01\x0e" - b"\x8a\x01\x0e" - b"\x8b\x01\x10" - b"\x8c\x01\x10" - b"\x8d\x01\x00" - b"\x8e\x01\x00" - b"\x8f\x01\x1f" - b"\x90\x01\x1f" - b"\x91\x01\x1e" - b"\x92\x01\x1e" - b"\x93\x01\x02" - b"\x94\x01\x04" - b"\x96\x01\x1e" - b"\x97\x01\x1e" - b"\x98\x01\x1f" - b"\x99\x01\x1f" - b"\x9a\x01\x05" - b"\x9b\x01\t" - b"\x9c\x01\t" - b"\x9d\x01\x0b" - b"\x9e\x01\x0b" - b"\x9f\x01\r" - b"\xa0\x01\r" - b"\xa1\x01\x0f" - b"\xa2\x01\x0f" - b"\xa3\x01\x00" - b"\xa4\x01\x00" - b"\xa5\x01\x1f" - b"\xa6\x01\x1f" - b"\xa7\x01\x1e" - b"\xa8\x01\x1e" - b"\xa9\x01\x01" - b"\xaa\x01\x03" - b"\xff\x010" - b"\xff\x01R" - b"\xff\x01\x00" - b"6\x01\n" - b"\x11\x81\x00\xc8" - b")\x81\x00d" - ) + b"\xff\x010" + b"\xff\x01R" + b"\xff\x01\x01" + b"\xe3\x01\x00" + b"\n\x01\x11" + b"#\x01\xa0" + b"$\x012" + b"%\x01\x12" + b"&\x01." + b"'\x01." + b")\x01\x02" + b"*\x01\xcf" + b"2\x014" + b"8\x01\x9c" + b"9\x01\xa7" + b":\x01'" + b";\x01\x94" + b"B\x01m" + b"C\x01\x83" + b"\x81\x01\x00" + b"\x91\x01g" + b"\x92\x01g" + b"\xa0\x01R" + b"\xa1\x01P" + b"\xa4\x01\x9c" + b"\xa7\x01\x02" + b"\xa8\x01\x02" + b"\xa9\x01\x02" + b"\xaa\x01\xa8" + b"\xab\x01(" + b"\xae\x01\xd2" + b"\xaf\x01\x02" + b"\xb0\x01\xd2" + b"\xb2\x01&" + b"\xb3\x01&" + b"\xff\x010" + b"\xff\x01R" + b"\xff\x01\x02" + b"\xb1\x01\n" + b"\xd1\x01\x0e" + b"\xb4\x01/" + b"\xd4\x01-" + b"\xb2\x01\x0c" + b"\xd2\x01\x0c" + b"\xb3\x010" + b"\xd3\x01*" + b"\xb6\x01\x1e" + b"\xd6\x01\x16" + b"\xb7\x01;" + b"\xd7\x015" + b"\xc1\x01\x08" + b"\xe1\x01\x08" + b"\xb8\x01\r" + b"\xd8\x01\r" + b"\xb9\x01\x05" + b"\xd9\x01\x05" + b"\xbd\x01\x15" + b"\xdd\x01\x15" + b"\xbc\x01\x13" + b"\xdc\x01\x13" + b"\xbb\x01\x12" + b"\xdb\x01\x10" + b"\xba\x01\x11" + b"\xda\x01\x11" + b"\xbe\x01\x17" + b"\xde\x01\x17" + b"\xbf\x01\x0f" + b"\xdf\x01\x0f" + b"\xc0\x01\x16" + b"\xe0\x01\x16" + b"\xb5\x01." + b"\xd5\x01?" + b"\xb0\x01\x03" + b"\xd0\x01\x02" + b"\xff\x010" + b"\xff\x01R" + b"\xff\x01\x03" + b"\x08\x01\t" + b"\t\x01\n" + b"\n\x01\x0b" + b"\x0b\x01\x0c" + b'(\x01"' + b"*\x01\xe9" + b"+\x01\xe9" + b"4\x01Q" + b"5\x01\x01" + b"6\x01&" + b"7\x01\x13" + b"@\x01\x07" + b"A\x01\x08" + b"B\x01\t" + b"C\x01\n" + b'D\x01"' + b"E\x01\xdb" + b"F\x01\xdc" + b'G\x01"' + b"H\x01\xdd" + b"I\x01\xde" + b"P\x01\x0b" + b"Q\x01\x0c" + b"R\x01\r" + b"S\x01\x0e" + b'T\x01"' + b"U\x01\xdf" + b"V\x01\xe0" + b'W\x01"' + b"X\x01\xe1" + b"Y\x01\xe2" + b"\x80\x01\x1e" + b"\x81\x01\x1e" + b"\x82\x01\x1f" + b"\x83\x01\x1f" + b"\x84\x01\x05" + b"\x85\x01\n" + b"\x86\x01\n" + b"\x87\x01\x0c" + b"\x88\x01\x0c" + b"\x89\x01\x0e" + b"\x8a\x01\x0e" + b"\x8b\x01\x10" + b"\x8c\x01\x10" + b"\x8d\x01\x00" + b"\x8e\x01\x00" + b"\x8f\x01\x1f" + b"\x90\x01\x1f" + b"\x91\x01\x1e" + b"\x92\x01\x1e" + b"\x93\x01\x02" + b"\x94\x01\x04" + b"\x96\x01\x1e" + b"\x97\x01\x1e" + b"\x98\x01\x1f" + b"\x99\x01\x1f" + b"\x9a\x01\x05" + b"\x9b\x01\t" + b"\x9c\x01\t" + b"\x9d\x01\x0b" + b"\x9e\x01\x0b" + b"\x9f\x01\r" + b"\xa0\x01\r" + b"\xa1\x01\x0f" + b"\xa2\x01\x0f" + b"\xa3\x01\x00" + b"\xa4\x01\x00" + b"\xa5\x01\x1f" + b"\xa6\x01\x1f" + b"\xa7\x01\x1e" + b"\xa8\x01\x1e" + b"\xa9\x01\x01" + b"\xaa\x01\x03" + b"\xff\x010" + b"\xff\x01R" + b"\xff\x01\x00" + b"6\x01\n" + b"\x11\x81\x00\xc8" + b")\x81\x00d" ) self._timings = { diff --git a/adafruit_qualia/displays/square34.py b/adafruit_qualia/displays/square34.py index 278e087..abd5760 100755 --- a/adafruit_qualia/displays/square34.py +++ b/adafruit_qualia/displays/square34.py @@ -33,49 +33,47 @@ class Square34(DotClockDisplay): def __init__(self): super().__init__() self._init_sequence = bytes( - ( - b"\xff\x05w\x01\x00\x00\x13" - b"\xef\x01\x08" - b"\xff\x05w\x01\x00\x00\x10" - b"\xc0\x02;\x00" - b"\xc1\x02\x12\n" - b"\xc2\x02\x07\x03" - b"\xc3\x01\x02" - b"\xcc\x01\x10" - b"\xcd\x01\x08" - b"\xb0\x10\x0f\x11\x17\x15\x15\t\x0c\x08\x08&\x04Y\x16f-\x1f" - b"\xb1\x10\x0f\x11\x17\x15\x15\t\x0c\x08\x08&\x04Y\x16f-\x1f" - b"\xff\x05w\x01\x00\x00\x11" - b"\xb0\x01m" - b"\xb1\x01:" - b"\xb2\x01\x01" - b"\xb3\x01\x80" - b"\xb5\x01I" - b"\xb7\x01\x85" - b"\xb8\x01 " - b"\xc1\x01x" - b"\xc2\x01x" - b"\xd0\x01\x88" - b"\xe0\x03\x00\x00\x02" - b"\xe1\x0b\x07\x00\t\x00\x06\x00\x08\x00\x0033" - b"\xe2\r\x11\x1133\xf6\x00\xf6\x00\xf6\x00\xf6\x00\x00" - b"\xe3\x04\x00\x00\x11\x11" - b"\xe4\x02DD" - b"\xe5\x10\x0f\xf3=\xff\x11\xf5=\xff\x0b\xef=\xff\r\xf1=\xff" - b"\xe6\x04\x00\x00\x11\x11" - b"\xe7\x02DD" - b"\xe8\x10\x0e\xf2=\xff\x10\xf4=\xff\n\xee=\xff\x0c\xf0=\xff" - b"\xe9\x026\x00" - b"\xeb\x07\x00\x01\xe4\xe4D\xaa\x10" - b"\xec\x02<\x00" - b"\xed\x10\xffEg\xfa\x01+\xcf\xff\xff\xfc\xb2\x10\xafvT\xff" - b"\xef\x06\x10\r\x04\x08?\x1f" - b"\xff\x05w\x01\x00\x00\x00" - b"5\x01\x00" - b":\x01f" - b"\x11\x80x" - b")\x802" - ) + b"\xff\x05w\x01\x00\x00\x13" + b"\xef\x01\x08" + b"\xff\x05w\x01\x00\x00\x10" + b"\xc0\x02;\x00" + b"\xc1\x02\x12\n" + b"\xc2\x02\x07\x03" + b"\xc3\x01\x02" + b"\xcc\x01\x10" + b"\xcd\x01\x08" + b"\xb0\x10\x0f\x11\x17\x15\x15\t\x0c\x08\x08&\x04Y\x16f-\x1f" + b"\xb1\x10\x0f\x11\x17\x15\x15\t\x0c\x08\x08&\x04Y\x16f-\x1f" + b"\xff\x05w\x01\x00\x00\x11" + b"\xb0\x01m" + b"\xb1\x01:" + b"\xb2\x01\x01" + b"\xb3\x01\x80" + b"\xb5\x01I" + b"\xb7\x01\x85" + b"\xb8\x01 " + b"\xc1\x01x" + b"\xc2\x01x" + b"\xd0\x01\x88" + b"\xe0\x03\x00\x00\x02" + b"\xe1\x0b\x07\x00\t\x00\x06\x00\x08\x00\x0033" + b"\xe2\r\x11\x1133\xf6\x00\xf6\x00\xf6\x00\xf6\x00\x00" + b"\xe3\x04\x00\x00\x11\x11" + b"\xe4\x02DD" + b"\xe5\x10\x0f\xf3=\xff\x11\xf5=\xff\x0b\xef=\xff\r\xf1=\xff" + b"\xe6\x04\x00\x00\x11\x11" + b"\xe7\x02DD" + b"\xe8\x10\x0e\xf2=\xff\x10\xf4=\xff\n\xee=\xff\x0c\xf0=\xff" + b"\xe9\x026\x00" + b"\xeb\x07\x00\x01\xe4\xe4D\xaa\x10" + b"\xec\x02<\x00" + b"\xed\x10\xffEg\xfa\x01+\xcf\xff\xff\xfc\xb2\x10\xafvT\xff" + b"\xef\x06\x10\r\x04\x08?\x1f" + b"\xff\x05w\x01\x00\x00\x00" + b"5\x01\x00" + b":\x01f" + b"\x11\x80x" + b")\x802" ) self._timings = { diff --git a/adafruit_qualia/displays/square40_480x480.py b/adafruit_qualia/displays/square40_480x480.py index d3c076e..a3cd646 100755 --- a/adafruit_qualia/displays/square40_480x480.py +++ b/adafruit_qualia/displays/square40_480x480.py @@ -32,45 +32,43 @@ class Square40_480x480(DotClockDisplay): def __init__(self): super().__init__() self._init_sequence = bytes( - ( - b"\xff\x05w\x01\x00\x00\x10" - b"\xc0\x02;\x00" - b"\xc1\x02\r\x02" - b"\xc2\x021\x05" - b"\xcd\x01\x08" - b'\xb0\x10\x00\x11\x18\x0e\x11\x06\x07\x08\x07"\x04\x12\x0f\xaa1\x18' - b'\xb1\x10\x00\x11\x19\x0e\x12\x07\x08\x08\x08"\x04\x11\x11\xa92\x18' - b"\xff\x05w\x01\x00\x00\x11" - b"\xb0\x01`" - b"\xb1\x012" - b"\xb2\x01\x07" - b"\xb3\x01\x80" - b"\xb5\x01I" - b"\xb7\x01\x85" - b"\xb8\x01!" - b"\xc1\x01x" - b"\xc2\x01x" - b"\xe0\x03\x00\x1b\x02" - b"\xe1\x0b\x08\xa0\x00\x00\x07\xa0\x00\x00\x00DD" - b"\xe2\x0c\x11\x11DD\xed\xa0\x00\x00\xec\xa0\x00\x00" - b"\xe3\x04\x00\x00\x11\x11" - b"\xe4\x02DD" - b"\xe5\x10\n\xe9\xd8\xa0\x0c\xeb\xd8\xa0\x0e\xed\xd8\xa0\x10\xef\xd8\xa0" - b"\xe6\x04\x00\x00\x11\x11" - b"\xe7\x02DD" - b"\xe8\x10\t\xe8\xd8\xa0\x0b\xea\xd8\xa0\r\xec\xd8\xa0\x0f\xee\xd8\xa0" - b"\xeb\x07\x02\x00\xe4\xe4\x88\x00@" - b"\xec\x02<\x00" - b"\xed\x10\xab\x89vT\x02\xff\xff\xff\xff\xff\xff Eg\x98\xba" - b"6\x01\x00" - b"\xff\x05w\x01\x00\x00\x13" - b"\xe5\x01\xe4" - b"\xff\x05w\x01\x00\x00\x00" - b":\x01f" - b"!\x80\n" - b"\x11\x80x" - b")\x00" - ) + b"\xff\x05w\x01\x00\x00\x10" + b"\xc0\x02;\x00" + b"\xc1\x02\r\x02" + b"\xc2\x021\x05" + b"\xcd\x01\x08" + b'\xb0\x10\x00\x11\x18\x0e\x11\x06\x07\x08\x07"\x04\x12\x0f\xaa1\x18' + b'\xb1\x10\x00\x11\x19\x0e\x12\x07\x08\x08\x08"\x04\x11\x11\xa92\x18' + b"\xff\x05w\x01\x00\x00\x11" + b"\xb0\x01`" + b"\xb1\x012" + b"\xb2\x01\x07" + b"\xb3\x01\x80" + b"\xb5\x01I" + b"\xb7\x01\x85" + b"\xb8\x01!" + b"\xc1\x01x" + b"\xc2\x01x" + b"\xe0\x03\x00\x1b\x02" + b"\xe1\x0b\x08\xa0\x00\x00\x07\xa0\x00\x00\x00DD" + b"\xe2\x0c\x11\x11DD\xed\xa0\x00\x00\xec\xa0\x00\x00" + b"\xe3\x04\x00\x00\x11\x11" + b"\xe4\x02DD" + b"\xe5\x10\n\xe9\xd8\xa0\x0c\xeb\xd8\xa0\x0e\xed\xd8\xa0\x10\xef\xd8\xa0" + b"\xe6\x04\x00\x00\x11\x11" + b"\xe7\x02DD" + b"\xe8\x10\t\xe8\xd8\xa0\x0b\xea\xd8\xa0\r\xec\xd8\xa0\x0f\xee\xd8\xa0" + b"\xeb\x07\x02\x00\xe4\xe4\x88\x00@" + b"\xec\x02<\x00" + b"\xed\x10\xab\x89vT\x02\xff\xff\xff\xff\xff\xff Eg\x98\xba" + b"6\x01\x00" + b"\xff\x05w\x01\x00\x00\x13" + b"\xe5\x01\xe4" + b"\xff\x05w\x01\x00\x00\x00" + b":\x01f" + b"!\x80\n" + b"\x11\x80x" + b")\x00" ) self._timings = { diff --git a/adafruit_qualia/graphics.py b/adafruit_qualia/graphics.py index 5ed5496..0976f4c 100755 --- a/adafruit_qualia/graphics.py +++ b/adafruit_qualia/graphics.py @@ -28,6 +28,7 @@ """ import os + from adafruit_portalbase.graphics import GraphicsBase __version__ = "0.0.0+auto.0" @@ -44,9 +45,7 @@ def load_displays(): display_folder = "/".join(display_folder) + "/displays" displays = os.listdir(display_folder) Displays._valid_displays = [ - x.split(".")[0] - for x in displays - if not (x.startswith("_")) and not (x.startswith(".")) + x.split(".")[0] for x in displays if not (x.startswith("_")) and not (x.startswith(".")) ] for display in Displays._valid_displays: setattr(Displays, display.upper(), display) @@ -81,7 +80,7 @@ def __init__( default_bg: int = 0, rotation: int = 0, scale: int = 1, - debug: bool = False + debug: bool = False, ) -> None: self._dotclock_display = None self.init_display(display_type, auto_refresh=auto_refresh) @@ -108,7 +107,7 @@ def case_insensitive_find(list_to_search, name): "Use Displays.valid_displays() to get a list of valid displays." ) - parent_class = self.__module__.split(".")[0] # pylint: disable=use-maxsplit-arg + parent_class = self.__module__.split(".")[0] class_path = (parent_class, "displays", display_type.lower()) display_class = __import__(".".join(class_path)) diff --git a/adafruit_qualia/network.py b/adafruit_qualia/network.py index ad2c99b..9afb041 100755 --- a/adafruit_qualia/network.py +++ b/adafruit_qualia/network.py @@ -28,13 +28,15 @@ """ import ssl + from adafruit_portalbase.network import NetworkBase from adafruit_portalbase.wifi_esp32s2 import WiFi try: - from typing import Optional, Union, Callable - from adafruit_io.adafruit_io import IO_MQTT + from typing import Callable, Optional, Union + import adafruit_minimqtt.adafruit_minimqtt as MQTT + from adafruit_io.adafruit_io import IO_MQTT except ImportError: pass @@ -53,7 +55,6 @@ class Network(NetworkBase): """ - # pylint: disable=too-many-instance-attributes, too-many-locals, too-many-branches, too-many-statements def __init__( self, *, @@ -71,14 +72,13 @@ def init_io_mqtt(self) -> IO_MQTT: """Initialize MQTT for Adafruit IO""" aio_username = self._get_setting["ADAFRUIT_AIO_USERNAME"] aio_key = self._get_setting["ADAFRUIT_AIO_KEY"] - if None in [aio_username, aio_key]: + if None in {aio_username, aio_key}: raise AttributeError( "Adafruit IO keys are kept in settings.toml, please add them there." ) return self.init_mqtt(IO_MQTT_BROKER, 8883, aio_username, aio_key, True) - # pylint: disable=too-many-arguments def init_mqtt( self, broker: str, @@ -102,16 +102,12 @@ def init_mqtt( return self._mqtt_client - # pylint: enable=too-many-arguments - def _get_mqtt_client(self) -> Union[MQTT.MQTT, IO_MQTT]: if self._mqtt_client is not None: return self._mqtt_client raise RuntimeError("Please initialize MQTT before using") - def mqtt_loop( - self, *args: int, suppress_mqtt_errors: bool = True, **kwargs: int - ) -> None: + def mqtt_loop(self, *args: int, suppress_mqtt_errors: bool = True, **kwargs: int) -> None: """Run the MQTT Loop""" self._get_mqtt_client() if suppress_mqtt_errors: @@ -122,9 +118,8 @@ def mqtt_loop( print(f"MMQTTException: {err}") except OSError as err: print(f"OSError: {err}") - else: - if self._mqtt_client is not None: - self._mqtt_client.loop(*args, **kwargs) + elif self._mqtt_client is not None: + self._mqtt_client.loop(*args, **kwargs) def mqtt_publish( self, @@ -140,13 +135,10 @@ def mqtt_publish( self._mqtt_client.publish(*args, **kwargs) except OSError as err: print(f"OSError: {err}") - else: - if self._mqtt_client is not None: - self._mqtt_client.publish(*args, **kwargs) + elif self._mqtt_client is not None: + self._mqtt_client.publish(*args, **kwargs) - def mqtt_connect( - self, *args: Union[bool, str, int], **kwargs: Union[bool, str, int] - ) -> None: + def mqtt_connect(self, *args: Union[bool, str, int], **kwargs: Union[bool, str, int]) -> None: """Connect to MQTT""" self._get_mqtt_client() if self._mqtt_client is not None: diff --git a/adafruit_qualia/peripherals.py b/adafruit_qualia/peripherals.py index 86a57d8..09579f7 100755 --- a/adafruit_qualia/peripherals.py +++ b/adafruit_qualia/peripherals.py @@ -30,10 +30,10 @@ """ +import adafruit_pca9554 import board import busio from digitalio import Pull -import adafruit_pca9554 __version__ = "0.0.0+auto.0" __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_Qualia.git" diff --git a/docs/api.rst b/docs/api.rst index 6788ca9..d27d5f7 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -4,6 +4,9 @@ .. If your library file(s) are nested in a directory (e.g. /adafruit_foo/foo.py) .. use this format as the module name: "adafruit_foo.foo" +API Reference +############# + .. automodule:: adafruit_qualia :members: diff --git a/docs/conf.py b/docs/conf.py index 46895ff..fb474c8 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,12 +1,10 @@ -# -*- coding: utf-8 -*- - # SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries # # SPDX-License-Identifier: MIT +import datetime import os import sys -import datetime sys.path.insert(0, os.path.abspath("..")) @@ -61,9 +59,7 @@ creation_year = "2023" 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 + " Melissa LeBlanc-Williams" author = "Melissa LeBlanc-Williams" diff --git a/examples/qualia_paint.py b/examples/qualia_paint.py index 745eaee..96bfe3b 100644 --- a/examples/qualia_paint.py +++ b/examples/qualia_paint.py @@ -3,8 +3,10 @@ """ Simple painting demo that works with on any touch display """ + import displayio -from adafruit_qualia.graphics import Graphics, Displays + +from adafruit_qualia.graphics import Displays, Graphics # For other displays: # 2.1" Round = Displays.ROUND21 @@ -39,9 +41,7 @@ for i in range(palette_width): color_index = i * 255 // palette_width - rgb565 = displayio.ColorConverter().convert( - color_index | color_index << 8 | color_index << 16 - ) + rgb565 = displayio.ColorConverter().convert(color_index | color_index << 8 | color_index << 16) r_mask = 0xF800 g_mask = 0x07E0 b_mask = 0x001F @@ -62,10 +62,7 @@ for touch in graphics.touch.touches: x = touch["x"] y = touch["y"] - if ( - not 0 <= x < graphics.display.width - or not 0 <= y < graphics.display.height - ): + if not 0 <= x < graphics.display.width or not 0 <= y < graphics.display.height: continue # Skip out of bounds touches if x < palette_width: current_color = bitmap[x, y] diff --git a/examples/qualia_qrcode_generation.py b/examples/qualia_qrcode_generation.py index 8f2a029..6eea58c 100644 --- a/examples/qualia_qrcode_generation.py +++ b/examples/qualia_qrcode_generation.py @@ -10,7 +10,8 @@ """ import time -from adafruit_qualia.graphics import Graphics, Displays + +from adafruit_qualia.graphics import Displays, Graphics from adafruit_qualia.peripherals import Peripherals # Background Information diff --git a/examples/qualia_quotes.py b/examples/qualia_quotes.py index 5104593..61c090b 100644 --- a/examples/qualia_quotes.py +++ b/examples/qualia_quotes.py @@ -4,6 +4,7 @@ # SPDX-License-Identifier: MIT import time + from adafruit_qualia import Qualia from adafruit_qualia.graphics import Displays diff --git a/ruff.toml b/ruff.toml new file mode 100644 index 0000000..73e9efc --- /dev/null +++ b/ruff.toml @@ -0,0 +1,108 @@ +# 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 + "PLR6301", # could-be-static no-self-use + "PLC0415", # import outside toplevel + "PLC2701", # private import +] + +[format] +line-ending = "lf"