commit
9b5a76b335
28 changed files with 345 additions and 681 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,duplicate-code
|
||||
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_EPD/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
|
||||
|
||||
This library is for using CircuitPython with e-ink displays with built in SRAM.
|
||||
|
||||
|
|
|
|||
|
|
@ -10,16 +10,19 @@ CircuitPython driver for Adafruit EK79686 display breakouts
|
|||
"""
|
||||
|
||||
import time
|
||||
from micropython import const
|
||||
|
||||
import adafruit_framebuf
|
||||
from micropython import const
|
||||
|
||||
from adafruit_epd.epd import Adafruit_EPD
|
||||
|
||||
try:
|
||||
"Needed for type annotations"
|
||||
import typing # pylint: disable=unused-import
|
||||
from typing_extensions import Literal
|
||||
import typing
|
||||
|
||||
from busio import SPI
|
||||
from digitalio import DigitalInOut
|
||||
from typing_extensions import Literal
|
||||
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
@ -56,7 +59,6 @@ _EK79686_VCM_DC_SETTING = const(0x82)
|
|||
class Adafruit_EK79686(Adafruit_EPD):
|
||||
"""driver class for Adafruit EK79686 ePaper display breakouts"""
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
def __init__(
|
||||
self,
|
||||
width: int,
|
||||
|
|
@ -67,11 +69,9 @@ class Adafruit_EK79686(Adafruit_EPD):
|
|||
dc_pin: DigitalInOut,
|
||||
sramcs_pin: DigitalInOut,
|
||||
rst_pin: DigitalInOut,
|
||||
busy_pin: DigitalInOut
|
||||
busy_pin: DigitalInOut,
|
||||
) -> None:
|
||||
super().__init__(
|
||||
width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin
|
||||
)
|
||||
super().__init__(width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin)
|
||||
|
||||
self._buffer1_size = int(width * height / 8)
|
||||
self._buffer2_size = int(width * height / 8)
|
||||
|
|
@ -158,9 +158,7 @@ class Adafruit_EK79686(Adafruit_EPD):
|
|||
return self.command(_EK79686_DTM2, end=False)
|
||||
raise RuntimeError("RAM index must be 0 or 1")
|
||||
|
||||
def set_ram_address(
|
||||
self, x: int, y: int
|
||||
) -> None: # pylint: disable=unused-argument, no-self-use
|
||||
def set_ram_address(self, x: int, y: int) -> None: # noqa: PLR6301, F841
|
||||
"""Set the RAM address location, not used on this chipset but required by
|
||||
the superclass"""
|
||||
return # on this chip it does nothing
|
||||
|
|
|
|||
|
|
@ -8,20 +8,22 @@
|
|||
CircuitPython driver for Adafruit ePaper display breakouts
|
||||
* Author(s): Dean Miller
|
||||
"""
|
||||
# pylint: disable=ungrouped-imports
|
||||
|
||||
import time
|
||||
from micropython import const
|
||||
|
||||
from digitalio import Direction
|
||||
from micropython import const
|
||||
|
||||
from adafruit_epd import mcp_sram
|
||||
|
||||
try:
|
||||
"""Needed for type annotations"""
|
||||
from typing import Any, Union, Callable, Optional
|
||||
from typing_extensions import Literal
|
||||
from typing import Any, Callable, Optional, Union
|
||||
|
||||
from busio import SPI
|
||||
from digitalio import DigitalInOut
|
||||
from circuitpython_typing.pil import Image
|
||||
from digitalio import DigitalInOut
|
||||
from typing_extensions import Literal
|
||||
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
@ -30,7 +32,7 @@ __version__ = "0.0.0+auto.0"
|
|||
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_EPD.git"
|
||||
|
||||
|
||||
class Adafruit_EPD: # pylint: disable=too-many-instance-attributes, too-many-public-methods, too-many-arguments
|
||||
class Adafruit_EPD:
|
||||
"""Base class for EPD displays"""
|
||||
|
||||
BLACK = const(0)
|
||||
|
|
@ -50,7 +52,7 @@ class Adafruit_EPD: # pylint: disable=too-many-instance-attributes, too-many-pu
|
|||
sramcs_pin: DigitalInOut,
|
||||
rst_pin: DigitalInOut,
|
||||
busy_pin: DigitalInOut,
|
||||
) -> None: # pylint: disable=too-many-arguments
|
||||
) -> None:
|
||||
self._width = width
|
||||
self._height = height
|
||||
|
||||
|
|
@ -96,7 +98,7 @@ class Adafruit_EPD: # pylint: disable=too-many-instance-attributes, too-many-pu
|
|||
self._black_inverted = self._color_inverted = True
|
||||
self.hardware_reset()
|
||||
|
||||
def display(self) -> None: # pylint: disable=too-many-branches
|
||||
def display(self) -> None:
|
||||
"""show the contents of the display buffer"""
|
||||
self.power_up()
|
||||
|
||||
|
|
@ -163,8 +165,7 @@ class Adafruit_EPD: # pylint: disable=too-many-instance-attributes, too-many-pu
|
|||
|
||||
self._cs.value = True
|
||||
self.spi_device.unlock()
|
||||
else:
|
||||
if self.sram:
|
||||
elif self.sram:
|
||||
self.sram.cs_pin.value = True
|
||||
|
||||
self.update()
|
||||
|
|
@ -177,9 +178,7 @@ class Adafruit_EPD: # pylint: disable=too-many-instance-attributes, too-many-pu
|
|||
self._rst.value = True
|
||||
time.sleep(0.1)
|
||||
|
||||
def command(
|
||||
self, cmd: int, data: Optional[bytearray] = None, end: bool = True
|
||||
) -> int:
|
||||
def command(self, cmd: int, data: Optional[bytearray] = None, end: bool = True) -> int:
|
||||
"""Send command byte to display."""
|
||||
self._cs.value = True
|
||||
self._dc.value = False
|
||||
|
|
@ -298,21 +297,15 @@ class Adafruit_EPD: # pylint: disable=too-many-instance-attributes, too-many-pu
|
|||
self._blackframebuf.fill(black_fill)
|
||||
self._colorframebuf.fill(red_fill)
|
||||
|
||||
def rect(
|
||||
self, x: int, y: int, width: int, height: int, color: int
|
||||
) -> None: # pylint: disable=too-many-arguments
|
||||
def rect(self, x: int, y: int, width: int, height: int, color: int) -> None:
|
||||
"""draw a rectangle"""
|
||||
self._color_dup("rect", (x, y, width, height), color)
|
||||
|
||||
def fill_rect(
|
||||
self, x: int, y: int, width: int, height: int, color: int
|
||||
) -> None: # pylint: disable=too-many-arguments
|
||||
def fill_rect(self, x: int, y: int, width: int, height: int, color: int) -> None:
|
||||
"""fill a rectangle with the passed color"""
|
||||
self._color_dup("fill_rect", (x, y, width, height), color)
|
||||
|
||||
def line(
|
||||
self, x_0: int, y_0: int, x_1: int, y_1: int, color: int
|
||||
) -> None: # pylint: disable=too-many-arguments
|
||||
def line(self, x_0: int, y_0: int, x_1: int, y_1: int, color: int) -> None:
|
||||
"""Draw a line from (x_0, y_0) to (x_1, y_1) in passed color"""
|
||||
self._color_dup("line", (x_0, y_0, x_1, y_1), color)
|
||||
|
||||
|
|
@ -324,7 +317,7 @@ class Adafruit_EPD: # pylint: disable=too-many-instance-attributes, too-many-pu
|
|||
color: int,
|
||||
*,
|
||||
font_name: str = "font5x8.bin",
|
||||
size: int = 1
|
||||
size: int = 1,
|
||||
) -> None:
|
||||
"""Write text string at location (x, y) in given color, using font file"""
|
||||
if self._blackframebuf is self._colorframebuf: # monochrome
|
||||
|
|
@ -357,14 +350,14 @@ class Adafruit_EPD: # pylint: disable=too-many-instance-attributes, too-many-pu
|
|||
@property
|
||||
def width(self) -> int:
|
||||
"""The width of the display, accounting for rotation"""
|
||||
if self.rotation in (0, 2):
|
||||
if self.rotation in {0, 2}:
|
||||
return self._width
|
||||
return self._height
|
||||
|
||||
@property
|
||||
def height(self) -> int:
|
||||
"""The height of the display, accounting for rotation"""
|
||||
if self.rotation in (0, 2):
|
||||
if self.rotation in {0, 2}:
|
||||
return self._height
|
||||
return self._width
|
||||
|
||||
|
|
@ -406,9 +399,7 @@ class Adafruit_EPD: # pylint: disable=too-many-instance-attributes, too-many-pu
|
|||
imwidth, imheight = image.size
|
||||
if imwidth != self.width or imheight != 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})."
|
||||
)
|
||||
if self.sram:
|
||||
raise RuntimeError("PIL image is not for use with SRAM assist")
|
||||
|
|
|
|||
|
|
@ -10,16 +10,19 @@ CircuitPython driver for Adafruit il0373 display breakouts
|
|||
"""
|
||||
|
||||
import time
|
||||
from micropython import const
|
||||
|
||||
import adafruit_framebuf
|
||||
from micropython import const
|
||||
|
||||
from adafruit_epd.epd import Adafruit_EPD
|
||||
|
||||
try:
|
||||
"""Needed for type annotations"""
|
||||
import typing # pylint: disable=unused-import
|
||||
from typing_extensions import Literal
|
||||
import typing
|
||||
|
||||
from busio import SPI
|
||||
from digitalio import DigitalInOut
|
||||
from typing_extensions import Literal
|
||||
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
@ -56,7 +59,6 @@ _IL0373_VCM_DC_SETTING = const(0x82)
|
|||
class Adafruit_IL0373(Adafruit_EPD):
|
||||
"""driver class for Adafruit IL0373 ePaper display breakouts"""
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
def __init__(
|
||||
self,
|
||||
width: int,
|
||||
|
|
@ -67,11 +69,9 @@ class Adafruit_IL0373(Adafruit_EPD):
|
|||
dc_pin: DigitalInOut,
|
||||
sramcs_pin: DigitalInOut,
|
||||
rst_pin: DigitalInOut,
|
||||
busy_pin: DigitalInOut
|
||||
busy_pin: DigitalInOut,
|
||||
) -> None:
|
||||
super().__init__(
|
||||
width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin
|
||||
)
|
||||
super().__init__(width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin)
|
||||
|
||||
self._buffer1_size = int(width * height / 8)
|
||||
self._buffer2_size = int(width * height / 8)
|
||||
|
|
@ -155,9 +155,7 @@ class Adafruit_IL0373(Adafruit_EPD):
|
|||
return self.command(_IL0373_DTM2, end=False)
|
||||
raise RuntimeError("RAM index must be 0 or 1")
|
||||
|
||||
def set_ram_address(
|
||||
self, x: int, y: int
|
||||
) -> None: # pylint: disable=unused-argument, no-self-use
|
||||
def set_ram_address(self, x: int, y: int) -> None: # noqa: PLR6301, F841
|
||||
"""Set the RAM address location, not used on this chipset but required by
|
||||
the superclass"""
|
||||
return # on this chip it does nothing
|
||||
|
|
|
|||
|
|
@ -10,16 +10,19 @@ CircuitPython driver for Adafruit IL0398 display breakouts
|
|||
"""
|
||||
|
||||
import time
|
||||
from micropython import const
|
||||
|
||||
import adafruit_framebuf
|
||||
from micropython import const
|
||||
|
||||
from adafruit_epd.epd import Adafruit_EPD
|
||||
|
||||
try:
|
||||
"""Needed for type annotations"""
|
||||
import typing # pylint: disable=unused-import
|
||||
from typing_extensions import Literal
|
||||
import typing
|
||||
|
||||
from busio import SPI
|
||||
from digitalio import DigitalInOut
|
||||
from typing_extensions import Literal
|
||||
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
@ -57,7 +60,6 @@ _IL0398_VCM_DC_SETTING = const(0x82)
|
|||
class Adafruit_IL0398(Adafruit_EPD):
|
||||
"""driver class for Adafruit IL0373 ePaper display breakouts"""
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
def __init__(
|
||||
self,
|
||||
width: int,
|
||||
|
|
@ -68,11 +70,9 @@ class Adafruit_IL0398(Adafruit_EPD):
|
|||
dc_pin: DigitalInOut,
|
||||
sramcs_pin: DigitalInOut,
|
||||
rst_pin: DigitalInOut,
|
||||
busy_pin: DigitalInOut
|
||||
busy_pin: DigitalInOut,
|
||||
) -> None:
|
||||
super().__init__(
|
||||
width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin
|
||||
)
|
||||
super().__init__(width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin)
|
||||
|
||||
self._buffer1_size = int(width * height / 8)
|
||||
self._buffer2_size = int(width * height / 8)
|
||||
|
|
@ -155,9 +155,7 @@ class Adafruit_IL0398(Adafruit_EPD):
|
|||
return self.command(_IL0398_DTM2, end=False)
|
||||
raise RuntimeError("RAM index must be 0 or 1")
|
||||
|
||||
def set_ram_address(
|
||||
self, x: int, y: int
|
||||
) -> None: # pylint: disable=unused-argument, no-self-use
|
||||
def set_ram_address(self, x: int, y: int) -> None: # noqa: PLR6301, F841
|
||||
"""Set the RAM address location, not used on this chipset but required by
|
||||
the superclass"""
|
||||
return # on this chip it does nothing
|
||||
|
|
|
|||
|
|
@ -10,16 +10,19 @@ CircuitPython driver for Adafruit IL91874 display breakouts
|
|||
"""
|
||||
|
||||
import time
|
||||
from micropython import const
|
||||
|
||||
import adafruit_framebuf
|
||||
from micropython import const
|
||||
|
||||
from adafruit_epd.epd import Adafruit_EPD
|
||||
|
||||
try:
|
||||
"Needed for type annotations"
|
||||
import typing # pylint: disable=unused-import
|
||||
from typing_extensions import Literal
|
||||
import typing
|
||||
|
||||
from busio import SPI
|
||||
from digitalio import DigitalInOut
|
||||
from typing_extensions import Literal
|
||||
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
@ -52,19 +55,16 @@ _IL91874_CDI = const(0x50)
|
|||
_IL91874_RESOLUTION = const(0x61)
|
||||
_IL91874_VCM_DC_SETTING = const(0x82)
|
||||
|
||||
# pylint: disable=line-too-long
|
||||
_LUT_VCOMDC = b"\x00\x00\x00\x1a\x1a\x00\x00\x01\x00\n\n\x00\x00\x08\x00\x0e\x01\x0e\x01\x10\x00\n\n\x00\x00\x08\x00\x04\x10\x00\x00\x05\x00\x03\x0e\x00\x00\n\x00#\x00\x00\x00\x01"
|
||||
_LUT_WW = b"\x90\x1a\x1a\x00\x00\x01@\n\n\x00\x00\x08\x84\x0e\x01\x0e\x01\x10\x80\n\n\x00\x00\x08\x00\x04\x10\x00\x00\x05\x00\x03\x0e\x00\x00\n\x00#\x00\x00\x00\x01"
|
||||
_LUT_BW = b"\xa0\x1a\x1a\x00\x00\x01\x00\n\n\x00\x00\x08\x84\x0e\x01\x0e\x01\x10\x90\n\n\x00\x00\x08\xb0\x04\x10\x00\x00\x05\xb0\x03\x0e\x00\x00\n\xc0#\x00\x00\x00\x01"
|
||||
_LUT_BB = b"\x90\x1a\x1a\x00\x00\x01@\n\n\x00\x00\x08\x84\x0e\x01\x0e\x01\x10\x80\n\n\x00\x00\x08\x00\x04\x10\x00\x00\x05\x00\x03\x0e\x00\x00\n\x00#\x00\x00\x00\x01"
|
||||
_LUT_WB = b"\x90\x1a\x1a\x00\x00\x01 \n\n\x00\x00\x08\x84\x0e\x01\x0e\x01\x10\x10\n\n\x00\x00\x08\x00\x04\x10\x00\x00\x05\x00\x03\x0e\x00\x00\n\x00#\x00\x00\x00\x01"
|
||||
# pylint: enable=line-too-long
|
||||
_LUT_VCOMDC = b"\x00\x00\x00\x1a\x1a\x00\x00\x01\x00\n\n\x00\x00\x08\x00\x0e\x01\x0e\x01\x10\x00\n\n\x00\x00\x08\x00\x04\x10\x00\x00\x05\x00\x03\x0e\x00\x00\n\x00#\x00\x00\x00\x01" # noqa: E501
|
||||
_LUT_WW = b"\x90\x1a\x1a\x00\x00\x01@\n\n\x00\x00\x08\x84\x0e\x01\x0e\x01\x10\x80\n\n\x00\x00\x08\x00\x04\x10\x00\x00\x05\x00\x03\x0e\x00\x00\n\x00#\x00\x00\x00\x01" # noqa: E501
|
||||
_LUT_BW = b"\xa0\x1a\x1a\x00\x00\x01\x00\n\n\x00\x00\x08\x84\x0e\x01\x0e\x01\x10\x90\n\n\x00\x00\x08\xb0\x04\x10\x00\x00\x05\xb0\x03\x0e\x00\x00\n\xc0#\x00\x00\x00\x01" # noqa: E501
|
||||
_LUT_BB = b"\x90\x1a\x1a\x00\x00\x01@\n\n\x00\x00\x08\x84\x0e\x01\x0e\x01\x10\x80\n\n\x00\x00\x08\x00\x04\x10\x00\x00\x05\x00\x03\x0e\x00\x00\n\x00#\x00\x00\x00\x01" # noqa: E501
|
||||
_LUT_WB = b"\x90\x1a\x1a\x00\x00\x01 \n\n\x00\x00\x08\x84\x0e\x01\x0e\x01\x10\x10\n\n\x00\x00\x08\x00\x04\x10\x00\x00\x05\x00\x03\x0e\x00\x00\n\x00#\x00\x00\x00\x01" # noqa: E501
|
||||
|
||||
|
||||
class Adafruit_IL91874(Adafruit_EPD):
|
||||
"""driver class for Adafruit IL91874 ePaper display breakouts"""
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
def __init__(
|
||||
self,
|
||||
width: int,
|
||||
|
|
@ -75,11 +75,9 @@ class Adafruit_IL91874(Adafruit_EPD):
|
|||
dc_pin: DigitalInOut,
|
||||
sramcs_pin: DigitalInOut,
|
||||
rst_pin: DigitalInOut,
|
||||
busy_pin: DigitalInOut
|
||||
busy_pin: DigitalInOut,
|
||||
) -> None:
|
||||
super().__init__(
|
||||
width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin
|
||||
)
|
||||
super().__init__(width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin)
|
||||
|
||||
self._buffer1_size = int(width * height / 8)
|
||||
self._buffer2_size = int(width * height / 8)
|
||||
|
|
@ -178,9 +176,7 @@ class Adafruit_IL91874(Adafruit_EPD):
|
|||
return self.command(_IL91874_DTM2, end=False)
|
||||
raise RuntimeError("RAM index must be 0 or 1")
|
||||
|
||||
def set_ram_address(
|
||||
self, x: int, y: int
|
||||
) -> None: # pylint: disable=unused-argument, no-self-use
|
||||
def set_ram_address(self, x: int, y: int) -> None: # noqa: PLR6301, F841
|
||||
"""Set the RAM address location, not used on this chipset but required by
|
||||
the superclass"""
|
||||
return # on this chip it does nothing
|
||||
|
|
|
|||
|
|
@ -9,15 +9,15 @@ CircuitPython driver for Microchip SRAM chips
|
|||
* Author(s): Dean Miller
|
||||
"""
|
||||
|
||||
from micropython import const
|
||||
from adafruit_bus_device import spi_device
|
||||
|
||||
from micropython import const
|
||||
|
||||
try:
|
||||
"""Needed for type annotations"""
|
||||
from typing import Any, List
|
||||
from digitalio import DigitalInOut
|
||||
|
||||
from busio import SPI
|
||||
from digitalio import DigitalInOut
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ class Adafruit_MCP_SRAM:
|
|||
self._buf[0] = Adafruit_MCP_SRAM.SRAM_WRSR
|
||||
self._buf[1] = 0x43
|
||||
with self._spi as spidev:
|
||||
spidev.write(self._buf, end=2) # pylint: disable=no-member
|
||||
spidev.write(self._buf, end=2)
|
||||
|
||||
def get_view(self, offset: int) -> Adafruit_MCP_SRAM_View:
|
||||
"""Create an object that can be used as a memoryview, with a given offset"""
|
||||
|
|
@ -74,8 +74,8 @@ class Adafruit_MCP_SRAM:
|
|||
self._buf[2] = addr & 0xFF
|
||||
|
||||
with self._spi as spi:
|
||||
spi.write(self._buf, end=3) # pylint: disable=no-member
|
||||
spi.write(bytearray(buf)) # pylint: disable=no-member
|
||||
spi.write(self._buf, end=3)
|
||||
spi.write(bytearray(buf))
|
||||
|
||||
def read(self, addr: int, length: int, reg: int = SRAM_READ):
|
||||
"""read passed number of bytes at the passed address"""
|
||||
|
|
@ -85,8 +85,8 @@ class Adafruit_MCP_SRAM:
|
|||
|
||||
buf = bytearray(length)
|
||||
with self._spi as spi:
|
||||
spi.write(self._buf, end=3) # pylint: disable=no-member
|
||||
spi.readinto(buf) # pylint: disable=no-member
|
||||
spi.write(self._buf, end=3)
|
||||
spi.readinto(buf)
|
||||
return buf
|
||||
|
||||
def read8(self, addr: int, reg: int = SRAM_READ):
|
||||
|
|
@ -113,6 +113,6 @@ class Adafruit_MCP_SRAM:
|
|||
self._buf[2] = addr & 0xFF
|
||||
fill = bytearray([value])
|
||||
with self._spi as spi:
|
||||
spi.write(self._buf, end=3) # pylint: disable=no-member
|
||||
spi.write(self._buf, end=3)
|
||||
for _ in range(length):
|
||||
spi.write(fill) # pylint: disable=no-member
|
||||
spi.write(fill)
|
||||
|
|
|
|||
|
|
@ -10,16 +10,19 @@ CircuitPython driver for Adafruit SSD1608 display breakouts
|
|||
"""
|
||||
|
||||
import time
|
||||
from micropython import const
|
||||
|
||||
import adafruit_framebuf
|
||||
from micropython import const
|
||||
|
||||
from adafruit_epd.epd import Adafruit_EPD
|
||||
|
||||
try:
|
||||
"""Needed for type annotations"""
|
||||
import typing # pylint: disable=unused-import
|
||||
from typing_extensions import Literal
|
||||
import typing
|
||||
|
||||
from busio import SPI
|
||||
from digitalio import DigitalInOut
|
||||
from typing_extensions import Literal
|
||||
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
@ -59,13 +62,14 @@ _SSD1608_SET_RAMYPOS = const(0x45)
|
|||
_SSD1608_SET_RAMXCOUNT = const(0x4E)
|
||||
_SSD1608_SET_RAMYCOUNT = const(0x4F)
|
||||
_SSD1608_NOP = const(0xFF)
|
||||
_LUT_DATA = b'\x02\x02\x01\x11\x12\x12""fiiYX\x99\x99\x88\x00\x00\x00\x00\xf8\xb4\x13Q5QQ\x19\x01\x00' # pylint: disable=line-too-long
|
||||
_LUT_DATA = (
|
||||
b'\x02\x02\x01\x11\x12\x12""fiiYX\x99\x99\x88\x00\x00\x00\x00\xf8\xb4\x13Q5QQ\x19\x01\x00' # noqa: E501
|
||||
)
|
||||
|
||||
|
||||
class Adafruit_SSD1608(Adafruit_EPD):
|
||||
"""driver class for Adafruit SSD1608 ePaper display breakouts"""
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
def __init__(
|
||||
self,
|
||||
width: int,
|
||||
|
|
@ -76,11 +80,9 @@ class Adafruit_SSD1608(Adafruit_EPD):
|
|||
dc_pin: DigitalInOut,
|
||||
sramcs_pin: DigitalInOut,
|
||||
rst_pin: DigitalInOut,
|
||||
busy_pin: DigitalInOut
|
||||
busy_pin: DigitalInOut,
|
||||
) -> None:
|
||||
super().__init__(
|
||||
width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin
|
||||
)
|
||||
super().__init__(width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin)
|
||||
|
||||
if height % 8 != 0:
|
||||
height += 8 - height % 8
|
||||
|
|
@ -165,9 +167,7 @@ class Adafruit_SSD1608(Adafruit_EPD):
|
|||
return self.command(_SSD1608_WRITE_RAM, end=False)
|
||||
raise RuntimeError("RAM index must be 0")
|
||||
|
||||
def set_ram_address(
|
||||
self, x: int, y: int
|
||||
) -> None: # pylint: disable=unused-argument, no-self-use
|
||||
def set_ram_address(self, x: int, y: int) -> None: # noqa: PLR6301, F841
|
||||
"""Set the RAM address location, not used on this chipset but required by
|
||||
the superclass"""
|
||||
# Set RAM X address counter
|
||||
|
|
|
|||
|
|
@ -10,16 +10,19 @@ CircuitPython driver for Adafruit SSD1675 display breakouts
|
|||
"""
|
||||
|
||||
import time
|
||||
from micropython import const
|
||||
|
||||
import adafruit_framebuf
|
||||
from micropython import const
|
||||
|
||||
from adafruit_epd.epd import Adafruit_EPD
|
||||
|
||||
try:
|
||||
"""Needed for type annotations"""
|
||||
import typing # pylint: disable=unused-import
|
||||
from typing_extensions import Literal
|
||||
import typing
|
||||
|
||||
from busio import SPI
|
||||
from digitalio import DigitalInOut
|
||||
from typing_extensions import Literal
|
||||
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
@ -53,13 +56,12 @@ _SSD1675_SET_RAMXCOUNT = const(0x4E)
|
|||
_SSD1675_SET_RAMYCOUNT = const(0x4F)
|
||||
_SSD1675_SET_ANALOGBLOCK = const(0x74)
|
||||
_SSD1675_SET_DIGITALBLOCK = const(0x7E)
|
||||
_LUT_DATA = b"\x80`@\x00\x00\x00\x00\x10` \x00\x00\x00\x00\x80`@\x00\x00\x00\x00\x10` \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x03\x00\x00\x02\t\t\x00\x00\x02\x03\x03\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15A\xa820\n" # pylint: disable=line-too-long
|
||||
_LUT_DATA = b"\x80`@\x00\x00\x00\x00\x10` \x00\x00\x00\x00\x80`@\x00\x00\x00\x00\x10` \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x03\x00\x00\x02\t\t\x00\x00\x02\x03\x03\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15A\xa820\n" # noqa: E501
|
||||
|
||||
|
||||
class Adafruit_SSD1675(Adafruit_EPD):
|
||||
"""driver class for Adafruit SSD1675 ePaper display breakouts"""
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
def __init__(
|
||||
self,
|
||||
width: int,
|
||||
|
|
@ -70,11 +72,9 @@ class Adafruit_SSD1675(Adafruit_EPD):
|
|||
dc_pin: DigitalInOut,
|
||||
sramcs_pin: DigitalInOut,
|
||||
rst_pin: DigitalInOut,
|
||||
busy_pin: DigitalInOut
|
||||
busy_pin: DigitalInOut,
|
||||
):
|
||||
super().__init__(
|
||||
width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin
|
||||
)
|
||||
super().__init__(width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin)
|
||||
stride = width
|
||||
if stride % 8 != 0:
|
||||
stride += 8 - stride % 8
|
||||
|
|
@ -189,9 +189,7 @@ class Adafruit_SSD1675(Adafruit_EPD):
|
|||
return self.command(_SSD1675_WRITE_RAM2, end=False)
|
||||
raise RuntimeError("RAM index must be 0 or 1")
|
||||
|
||||
def set_ram_address(
|
||||
self, x: int, y: int
|
||||
) -> None: # pylint: disable=unused-argument, no-self-use
|
||||
def set_ram_address(self, x: int, y: int) -> None: # noqa: PLR6301, F841
|
||||
"""Set the RAM address location, not used on this chipset but required by
|
||||
the superclass"""
|
||||
self.command(_SSD1675_SET_RAMXCOUNT, bytearray([x]))
|
||||
|
|
|
|||
|
|
@ -10,16 +10,19 @@ CircuitPython driver for Adafruit SSD1675 display breakouts
|
|||
"""
|
||||
|
||||
import time
|
||||
from micropython import const
|
||||
|
||||
import adafruit_framebuf
|
||||
from micropython import const
|
||||
|
||||
from adafruit_epd.epd import Adafruit_EPD
|
||||
|
||||
try:
|
||||
"""Needed for type annotations"""
|
||||
import typing # pylint: disable=unused-import
|
||||
from typing_extensions import Literal
|
||||
import typing
|
||||
|
||||
from busio import SPI
|
||||
from digitalio import DigitalInOut
|
||||
from typing_extensions import Literal
|
||||
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
@ -79,13 +82,12 @@ _SSD1675B_SET_RAMYCOUNT = const(0x4F)
|
|||
_SSD1675B_SET_ANALOGBLOCK = const(0x74)
|
||||
_SSD1675B_SET_DIGITALBLOCK = const(0x7E)
|
||||
_SSD1675B_NOP = const(0xFF)
|
||||
_LUT_DATA = b"\xa0\x90P\x00\x00\x00\x00\x00\x00\x00P\x90\xa0\x00\x00\x00\x00\x00\x00\x00\xa0\x90P\x00\x00\x00\x00\x00\x00\x00P\x90\xa0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0f\x0f\x00\x00\x00\x0f\x0f\x00\x00\x03\x0f\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15A\xa82P,\x0b" # pylint: disable=line-too-long
|
||||
_LUT_DATA = b"\xa0\x90P\x00\x00\x00\x00\x00\x00\x00P\x90\xa0\x00\x00\x00\x00\x00\x00\x00\xa0\x90P\x00\x00\x00\x00\x00\x00\x00P\x90\xa0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0f\x0f\x00\x00\x00\x0f\x0f\x00\x00\x03\x0f\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15A\xa82P,\x0b" # noqa: E501
|
||||
|
||||
|
||||
class Adafruit_SSD1675B(Adafruit_EPD):
|
||||
"""driver class for Adafruit SSD1675B ePaper display breakouts"""
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
def __init__(
|
||||
self,
|
||||
width: int,
|
||||
|
|
@ -96,11 +98,9 @@ class Adafruit_SSD1675B(Adafruit_EPD):
|
|||
dc_pin: DigitalInOut,
|
||||
sramcs_pin: DigitalInOut,
|
||||
rst_pin: DigitalInOut,
|
||||
busy_pin: DigitalInOut
|
||||
busy_pin: DigitalInOut,
|
||||
) -> None:
|
||||
super().__init__(
|
||||
width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin
|
||||
)
|
||||
super().__init__(width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin)
|
||||
stride = width
|
||||
if stride % 8 != 0:
|
||||
stride += 8 - stride % 8
|
||||
|
|
@ -231,9 +231,7 @@ class Adafruit_SSD1675B(Adafruit_EPD):
|
|||
return self.command(_SSD1675B_WRITE_RAM2, end=False)
|
||||
raise RuntimeError("RAM index must be 0 or 1")
|
||||
|
||||
def set_ram_address(
|
||||
self, x: int, y: int
|
||||
) -> None: # pylint: disable=unused-argument, no-self-use
|
||||
def set_ram_address(self, x: int, y: int) -> None: # noqa: PLR6301, F841
|
||||
"""Set the RAM address location, not used on this chipset but required by
|
||||
the superclass"""
|
||||
self.command(_SSD1675B_SET_RAMXCOUNT, bytearray([x]))
|
||||
|
|
|
|||
|
|
@ -10,16 +10,19 @@ CircuitPython driver for Adafruit SSD1680 display breakouts
|
|||
"""
|
||||
|
||||
import time
|
||||
from micropython import const
|
||||
|
||||
import adafruit_framebuf
|
||||
from micropython import const
|
||||
|
||||
from adafruit_epd.epd import Adafruit_EPD
|
||||
|
||||
try:
|
||||
"""Needed for type annotations"""
|
||||
import typing # pylint: disable=unused-import
|
||||
from typing_extensions import Literal
|
||||
import typing
|
||||
|
||||
from busio import SPI
|
||||
from digitalio import DigitalInOut
|
||||
from typing_extensions import Literal
|
||||
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
@ -80,7 +83,6 @@ _SSD1680_NOP = const(0xFF)
|
|||
class Adafruit_SSD1680(Adafruit_EPD):
|
||||
"""driver class for Adafruit SSD1680 ePaper display breakouts"""
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
def __init__(
|
||||
self,
|
||||
width: int,
|
||||
|
|
@ -91,11 +93,9 @@ class Adafruit_SSD1680(Adafruit_EPD):
|
|||
dc_pin: DigitalInOut,
|
||||
sramcs_pin: DigitalInOut,
|
||||
rst_pin: DigitalInOut,
|
||||
busy_pin: DigitalInOut
|
||||
busy_pin: DigitalInOut,
|
||||
) -> None:
|
||||
super().__init__(
|
||||
width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin
|
||||
)
|
||||
super().__init__(width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin)
|
||||
|
||||
stride = width
|
||||
if stride % 8 != 0:
|
||||
|
|
@ -202,9 +202,7 @@ class Adafruit_SSD1680(Adafruit_EPD):
|
|||
return self.command(_SSD1680_WRITE_REDRAM, end=False)
|
||||
raise RuntimeError("RAM index must be 0 or 1")
|
||||
|
||||
def set_ram_address(
|
||||
self, x: int, y: int
|
||||
) -> None: # pylint: disable=unused-argument, no-self-use
|
||||
def set_ram_address(self, x: int, y: int) -> None: # noqa: PLR6301, F841
|
||||
"""Set the RAM address location, not used on this chipset but required by
|
||||
the superclass"""
|
||||
# Set RAM X address counter
|
||||
|
|
@ -216,10 +214,7 @@ class Adafruit_SSD1680(Adafruit_EPD):
|
|||
class Adafruit_SSD1680Z(Adafruit_SSD1680):
|
||||
"""Driver for SSD1680Z ePaper display, overriding SSD1680 settings."""
|
||||
|
||||
# pylint: disable=too-many-arguments, useless-parent-delegation
|
||||
def __init__(
|
||||
self, width, height, spi, *, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin
|
||||
):
|
||||
def __init__(self, width, height, spi, *, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin):
|
||||
# Call the parent class's __init__() to initialize attributes
|
||||
super().__init__(
|
||||
width,
|
||||
|
|
@ -276,9 +271,7 @@ class Adafruit_SSD1680Z(Adafruit_SSD1680):
|
|||
if not self.busy_pin:
|
||||
time.sleep(3) # Wait for update to complete
|
||||
|
||||
def set_ram_address(
|
||||
self, x: int, y: int
|
||||
) -> None: # pylint: disable=unused-argument, no-self-use
|
||||
def set_ram_address(self, x: int, y: int) -> None: # noqa: PLR6301, F841
|
||||
"""Set the RAM address location, not used on this chipset but required by
|
||||
the superclass"""
|
||||
# Set RAM X address counter
|
||||
|
|
|
|||
|
|
@ -10,15 +10,18 @@ CircuitPython driver for Adafruit SSD1681 display breakouts
|
|||
"""
|
||||
|
||||
import time
|
||||
from micropython import const
|
||||
|
||||
import adafruit_framebuf
|
||||
from micropython import const
|
||||
|
||||
from adafruit_epd.epd import Adafruit_EPD
|
||||
|
||||
try:
|
||||
import typing # pylint: disable=unused-import
|
||||
from typing_extensions import Literal
|
||||
import typing
|
||||
|
||||
from busio import SPI
|
||||
from digitalio import DigitalInOut
|
||||
from typing_extensions import Literal
|
||||
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
@ -79,7 +82,6 @@ _SSD1681_NOP = const(0xFF)
|
|||
class Adafruit_SSD1681(Adafruit_EPD):
|
||||
"""driver class for Adafruit SSD1681 ePaper display breakouts"""
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
def __init__(
|
||||
self,
|
||||
width: int,
|
||||
|
|
@ -90,11 +92,9 @@ class Adafruit_SSD1681(Adafruit_EPD):
|
|||
dc_pin: DigitalInOut,
|
||||
sramcs_pin: DigitalInOut,
|
||||
rst_pin: DigitalInOut,
|
||||
busy_pin: DigitalInOut
|
||||
busy_pin: DigitalInOut,
|
||||
) -> None:
|
||||
super().__init__(
|
||||
width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin
|
||||
)
|
||||
super().__init__(width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin)
|
||||
|
||||
if height % 8 != 0:
|
||||
height += 8 - height % 8
|
||||
|
|
@ -184,9 +184,7 @@ class Adafruit_SSD1681(Adafruit_EPD):
|
|||
return self.command(_SSD1681_WRITE_REDRAM, end=False)
|
||||
raise RuntimeError("RAM index must be 0 or 1")
|
||||
|
||||
def set_ram_address(
|
||||
self, x: int, y: int
|
||||
) -> None: # pylint: disable=unused-argument, no-self-use
|
||||
def set_ram_address(self, x: int, y: int) -> None: # noqa: PLR6301, F841
|
||||
"""Set the RAM address location, not used on this chipset but required by
|
||||
the superclass"""
|
||||
# Set RAM X address counter
|
||||
|
|
|
|||
|
|
@ -10,16 +10,19 @@ CircuitPython driver for Adafruit UC8151D display breakouts
|
|||
"""
|
||||
|
||||
import time
|
||||
from micropython import const
|
||||
|
||||
import adafruit_framebuf
|
||||
from micropython import const
|
||||
|
||||
from adafruit_epd.epd import Adafruit_EPD
|
||||
|
||||
try:
|
||||
"""Needed for type annotations"""
|
||||
import typing # pylint: disable=unused-import
|
||||
from typing_extensions import Literal
|
||||
import typing
|
||||
|
||||
from busio import SPI
|
||||
from digitalio import DigitalInOut
|
||||
from typing_extensions import Literal
|
||||
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
@ -71,7 +74,6 @@ _UC8151D_TSSET = const(0xE5)
|
|||
class Adafruit_UC8151D(Adafruit_EPD):
|
||||
"""driver class for Adafruit UC8151D ePaper display breakouts"""
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
def __init__(
|
||||
self,
|
||||
width: int,
|
||||
|
|
@ -82,11 +84,9 @@ class Adafruit_UC8151D(Adafruit_EPD):
|
|||
dc_pin: DigitalInOut,
|
||||
sramcs_pin: DigitalInOut,
|
||||
rst_pin: DigitalInOut,
|
||||
busy_pin: DigitalInOut
|
||||
busy_pin: DigitalInOut,
|
||||
) -> None:
|
||||
super().__init__(
|
||||
width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin
|
||||
)
|
||||
super().__init__(width, height, spi, cs_pin, dc_pin, sramcs_pin, rst_pin, busy_pin)
|
||||
|
||||
self._buffer1_size = int(width * height / 8)
|
||||
self._buffer2_size = int(width * height / 8)
|
||||
|
|
@ -163,9 +163,7 @@ class Adafruit_UC8151D(Adafruit_EPD):
|
|||
return self.command(_UC8151D_DTM2, end=False)
|
||||
raise RuntimeError("RAM index must be 0 or 1")
|
||||
|
||||
def set_ram_address(
|
||||
self, x: int, y: int
|
||||
) -> None: # pylint: disable=unused-argument, no-self-use
|
||||
def set_ram_address(self, x: int, y: int) -> None: # noqa: PLR6301, F841
|
||||
"""Set the RAM address location, not used on this chipset but required by
|
||||
the superclass"""
|
||||
return # on this chip it does nothing
|
||||
|
|
|
|||
|
|
@ -4,5 +4,8 @@
|
|||
.. If your library file(s) are nested in a directory (e.g. /adafruit_foo/foo.py)
|
||||
.. use this format as the module name: "adafruit_foo.foo"
|
||||
|
||||
API Reference
|
||||
#############
|
||||
|
||||
.. automodule:: adafruit_epd.epd
|
||||
: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(".."))
|
||||
|
||||
|
|
@ -55,9 +53,7 @@ project = "Adafruit EPD Library"
|
|||
creation_year = "2018"
|
||||
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 + " Dean Miller"
|
||||
author = "Dean Miller"
|
||||
|
|
|
|||
|
|
@ -1,20 +1,20 @@
|
|||
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
import digitalio
|
||||
import busio
|
||||
import board
|
||||
import busio
|
||||
import digitalio
|
||||
|
||||
from adafruit_epd.ek79686 import Adafruit_EK79686
|
||||
from adafruit_epd.epd import Adafruit_EPD
|
||||
from adafruit_epd.il0373 import Adafruit_IL0373
|
||||
from adafruit_epd.il91874 import Adafruit_IL91874 # pylint: disable=unused-import
|
||||
from adafruit_epd.il0398 import Adafruit_IL0398 # pylint: disable=unused-import
|
||||
from adafruit_epd.ssd1608 import Adafruit_SSD1608 # pylint: disable=unused-import
|
||||
from adafruit_epd.ssd1675 import Adafruit_SSD1675 # pylint: disable=unused-import
|
||||
from adafruit_epd.ssd1680 import Adafruit_SSD1680 # pylint: disable=unused-import
|
||||
from adafruit_epd.ssd1681 import Adafruit_SSD1681 # pylint: disable=unused-import
|
||||
from adafruit_epd.uc8151d import Adafruit_UC8151D # pylint: disable=unused-import
|
||||
from adafruit_epd.ek79686 import Adafruit_EK79686 # pylint: disable=unused-import
|
||||
|
||||
from adafruit_epd.il0398 import Adafruit_IL0398
|
||||
from adafruit_epd.il91874 import Adafruit_IL91874
|
||||
from adafruit_epd.ssd1608 import Adafruit_SSD1608
|
||||
from adafruit_epd.ssd1675 import Adafruit_SSD1675
|
||||
from adafruit_epd.ssd1680 import Adafruit_SSD1680
|
||||
from adafruit_epd.ssd1681 import Adafruit_SSD1681
|
||||
from adafruit_epd.uc8151d import Adafruit_UC8151D
|
||||
|
||||
# create the spi device and pins we will need
|
||||
spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
|
||||
|
|
@ -74,9 +74,9 @@ class BMPError(Exception):
|
|||
pass
|
||||
|
||||
|
||||
def display_bitmap(epd, filename): # pylint: disable=too-many-locals, too-many-branches
|
||||
def display_bitmap(epd, filename):
|
||||
try:
|
||||
f = open(filename, "rb") # pylint: disable=consider-using-with
|
||||
f = open(filename, "rb")
|
||||
except OSError:
|
||||
print("Couldn't open file")
|
||||
return
|
||||
|
|
|
|||
|
|
@ -1,24 +1,22 @@
|
|||
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
import digitalio
|
||||
import busio
|
||||
import board
|
||||
import busio
|
||||
import digitalio
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
|
||||
from PIL import Image
|
||||
from PIL import ImageDraw
|
||||
from PIL import ImageFont
|
||||
from adafruit_epd.ek79686 import Adafruit_EK79686
|
||||
from adafruit_epd.epd import Adafruit_EPD
|
||||
from adafruit_epd.il0373 import Adafruit_IL0373 # pylint: disable=unused-import
|
||||
from adafruit_epd.il91874 import Adafruit_IL91874 # pylint: disable=unused-import
|
||||
from adafruit_epd.il0398 import Adafruit_IL0398 # pylint: disable=unused-import
|
||||
from adafruit_epd.ssd1608 import Adafruit_SSD1608 # pylint: disable=unused-import
|
||||
from adafruit_epd.ssd1675 import Adafruit_SSD1675 # pylint: disable=unused-import
|
||||
from adafruit_epd.ssd1675b import Adafruit_SSD1675B # pylint: disable=unused-import
|
||||
from adafruit_epd.ssd1680 import Adafruit_SSD1680 # pylint: disable=unused-import
|
||||
from adafruit_epd.ssd1681 import Adafruit_SSD1681 # pylint: disable=unused-import
|
||||
from adafruit_epd.uc8151d import Adafruit_UC8151D # pylint: disable=unused-import
|
||||
from adafruit_epd.ek79686 import Adafruit_EK79686 # pylint: disable=unused-import
|
||||
from adafruit_epd.il0373 import Adafruit_IL0373
|
||||
from adafruit_epd.il0398 import Adafruit_IL0398
|
||||
from adafruit_epd.il91874 import Adafruit_IL91874
|
||||
from adafruit_epd.ssd1608 import Adafruit_SSD1608
|
||||
from adafruit_epd.ssd1675 import Adafruit_SSD1675
|
||||
from adafruit_epd.ssd1675b import Adafruit_SSD1675B
|
||||
from adafruit_epd.ssd1680 import Adafruit_SSD1680
|
||||
from adafruit_epd.ssd1681 import Adafruit_SSD1681
|
||||
from adafruit_epd.uc8151d import Adafruit_UC8151D
|
||||
|
||||
# create the spi device and pins we will need
|
||||
spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
|
||||
|
|
|
|||
|
|
@ -2,15 +2,14 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
|
||||
import time
|
||||
import busio
|
||||
import board
|
||||
from digitalio import DigitalInOut, Direction
|
||||
|
||||
from PIL import Image
|
||||
from PIL import ImageDraw
|
||||
from PIL import ImageFont
|
||||
import board
|
||||
import busio
|
||||
from digitalio import DigitalInOut, Direction
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
|
||||
from adafruit_epd.epd import Adafruit_EPD
|
||||
from adafruit_epd.ssd1675b import Adafruit_SSD1675B # pylint: disable=unused-import
|
||||
from adafruit_epd.ssd1675b import Adafruit_SSD1675B
|
||||
|
||||
# create two buttons
|
||||
switch1 = DigitalInOut(board.D6)
|
||||
|
|
|
|||
|
|
@ -6,19 +6,20 @@ ePaper Display Shapes and Text demo using the Pillow Library.
|
|||
|
||||
"""
|
||||
|
||||
import digitalio
|
||||
import busio
|
||||
import board
|
||||
import busio
|
||||
import digitalio
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
|
||||
from adafruit_epd.ek79686 import Adafruit_EK79686
|
||||
from adafruit_epd.il0373 import Adafruit_IL0373
|
||||
from adafruit_epd.il91874 import Adafruit_IL91874 # pylint: disable=unused-import
|
||||
from adafruit_epd.il0398 import Adafruit_IL0398 # pylint: disable=unused-import
|
||||
from adafruit_epd.ssd1608 import Adafruit_SSD1608 # pylint: disable=unused-import
|
||||
from adafruit_epd.ssd1675 import Adafruit_SSD1675 # pylint: disable=unused-import
|
||||
from adafruit_epd.ssd1680 import Adafruit_SSD1680 # pylint: disable=unused-import
|
||||
from adafruit_epd.ssd1681 import Adafruit_SSD1681 # pylint: disable=unused-import
|
||||
from adafruit_epd.uc8151d import Adafruit_UC8151D # pylint: disable=unused-import
|
||||
from adafruit_epd.ek79686 import Adafruit_EK79686 # pylint: disable=unused-import
|
||||
from adafruit_epd.il0398 import Adafruit_IL0398
|
||||
from adafruit_epd.il91874 import Adafruit_IL91874
|
||||
from adafruit_epd.ssd1608 import Adafruit_SSD1608
|
||||
from adafruit_epd.ssd1675 import Adafruit_SSD1675
|
||||
from adafruit_epd.ssd1680 import Adafruit_SSD1680
|
||||
from adafruit_epd.ssd1681 import Adafruit_SSD1681
|
||||
from adafruit_epd.uc8151d import Adafruit_UC8151D
|
||||
|
||||
# First define some color constants
|
||||
WHITE = (0xFF, 0xFF, 0xFF)
|
||||
|
|
|
|||
|
|
@ -8,20 +8,20 @@ https://learn.adafruit.com/adafruit-eink-display-breakouts/python-code
|
|||
|
||||
"""
|
||||
|
||||
import digitalio
|
||||
import busio
|
||||
import board
|
||||
import busio
|
||||
import digitalio
|
||||
from PIL import Image
|
||||
from adafruit_epd.il0373 import Adafruit_IL0373
|
||||
from adafruit_epd.il91874 import Adafruit_IL91874 # pylint: disable=unused-import
|
||||
from adafruit_epd.il0398 import Adafruit_IL0398 # pylint: disable=unused-import
|
||||
from adafruit_epd.ssd1608 import Adafruit_SSD1608 # pylint: disable=unused-import
|
||||
from adafruit_epd.ssd1675 import Adafruit_SSD1675 # pylint: disable=unused-import
|
||||
from adafruit_epd.ssd1680 import Adafruit_SSD1680 # pylint: disable=unused-import
|
||||
from adafruit_epd.ssd1681 import Adafruit_SSD1681 # pylint: disable=unused-import
|
||||
from adafruit_epd.uc8151d import Adafruit_UC8151D # pylint: disable=unused-import
|
||||
from adafruit_epd.ek79686 import Adafruit_EK79686 # pylint: disable=unused-import
|
||||
|
||||
from adafruit_epd.ek79686 import Adafruit_EK79686
|
||||
from adafruit_epd.il0373 import Adafruit_IL0373
|
||||
from adafruit_epd.il0398 import Adafruit_IL0398
|
||||
from adafruit_epd.il91874 import Adafruit_IL91874
|
||||
from adafruit_epd.ssd1608 import Adafruit_SSD1608
|
||||
from adafruit_epd.ssd1675 import Adafruit_SSD1675
|
||||
from adafruit_epd.ssd1680 import Adafruit_SSD1680
|
||||
from adafruit_epd.ssd1681 import Adafruit_SSD1681
|
||||
from adafruit_epd.uc8151d import Adafruit_UC8151D
|
||||
|
||||
# create the spi device and pins we will need
|
||||
spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
|
||||
|
|
|
|||
|
|
@ -3,10 +3,12 @@
|
|||
|
||||
# EInk Shield test
|
||||
import time
|
||||
import digitalio
|
||||
import busio
|
||||
|
||||
import board
|
||||
import busio
|
||||
import digitalio
|
||||
from analogio import AnalogIn
|
||||
|
||||
from adafruit_epd.epd import Adafruit_EPD
|
||||
from adafruit_epd.il91874 import Adafruit_IL91874
|
||||
|
||||
|
|
|
|||
|
|
@ -1,19 +1,20 @@
|
|||
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
import digitalio
|
||||
import busio
|
||||
import board
|
||||
import busio
|
||||
import digitalio
|
||||
|
||||
from adafruit_epd.ek79686 import Adafruit_EK79686
|
||||
from adafruit_epd.epd import Adafruit_EPD
|
||||
from adafruit_epd.il0373 import Adafruit_IL0373
|
||||
from adafruit_epd.il91874 import Adafruit_IL91874 # pylint: disable=unused-import
|
||||
from adafruit_epd.il0398 import Adafruit_IL0398 # pylint: disable=unused-import
|
||||
from adafruit_epd.ssd1608 import Adafruit_SSD1608 # pylint: disable=unused-import
|
||||
from adafruit_epd.ssd1675 import Adafruit_SSD1675 # pylint: disable=unused-import
|
||||
from adafruit_epd.ssd1680 import Adafruit_SSD1680 # pylint: disable=unused-import
|
||||
from adafruit_epd.ssd1681 import Adafruit_SSD1681 # pylint: disable=unused-import
|
||||
from adafruit_epd.uc8151d import Adafruit_UC8151D # pylint: disable=unused-import
|
||||
from adafruit_epd.ek79686 import Adafruit_EK79686 # pylint: disable=unused-import
|
||||
from adafruit_epd.il0398 import Adafruit_IL0398
|
||||
from adafruit_epd.il91874 import Adafruit_IL91874
|
||||
from adafruit_epd.ssd1608 import Adafruit_SSD1608
|
||||
from adafruit_epd.ssd1675 import Adafruit_SSD1675
|
||||
from adafruit_epd.ssd1680 import Adafruit_SSD1680
|
||||
from adafruit_epd.ssd1681 import Adafruit_SSD1681
|
||||
from adafruit_epd.uc8151d import Adafruit_UC8151D
|
||||
|
||||
# create the spi device and pins we will need
|
||||
spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
|
||||
|
|
|
|||
|
|
@ -2,9 +2,11 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
|
||||
import time
|
||||
import digitalio
|
||||
import busio
|
||||
|
||||
import board
|
||||
import busio
|
||||
import digitalio
|
||||
|
||||
from adafruit_epd.epd import Adafruit_EPD
|
||||
from adafruit_epd.ssd1680 import Adafruit_SSD1680
|
||||
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
|
||||
import time
|
||||
import digitalio
|
||||
import busio
|
||||
|
||||
import board
|
||||
from PIL import Image
|
||||
from PIL import ImageDraw
|
||||
from PIL import ImageFont
|
||||
import busio
|
||||
import digitalio
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
|
||||
from adafruit_epd.epd import Adafruit_EPD
|
||||
from adafruit_epd.ssd1680 import Adafruit_SSD1680
|
||||
|
||||
|
|
|
|||
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