adafruit-circuitpython-pybadger 4.0.3__tar.gz → 4.0.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- adafruit_circuitpython_pybadger-4.0.5/.gitattributes +11 -0
- adafruit_circuitpython_pybadger-4.0.5/.pre-commit-config.yaml +21 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/.readthedocs.yaml +1 -1
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/PKG-INFO +5 -5
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/README.rst +3 -3
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/adafruit_circuitpython_pybadger.egg-info/PKG-INFO +5 -5
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/adafruit_circuitpython_pybadger.egg-info/SOURCES.txt +2 -1
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/adafruit_pybadger/clue.py +9 -9
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/adafruit_pybadger/cpb_gizmo.py +10 -11
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/adafruit_pybadger/magtag.py +4 -3
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/adafruit_pybadger/pewpewm4.py +6 -7
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/adafruit_pybadger/pybadge.py +10 -13
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/adafruit_pybadger/pybadger_base.py +32 -58
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/adafruit_pybadger/pygamer.py +11 -13
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/adafruit_pybadger/pyportal.py +5 -3
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/docs/api.rst +3 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/docs/conf.py +2 -6
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/docs/mocks/keypad.py +1 -1
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/examples/pybadger_button_debouncing.py +1 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/examples/pybadger_clue_custom_badge.py +4 -9
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/examples/pybadger_clue_custom_image_badge.py +2 -3
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/examples/pybadger_custom_badge.py +4 -9
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/examples/pybadger_magtag_simpletest.py +5 -4
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/examples/pybadger_pewpewm4_simpletest.py +4 -7
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/examples/pybadger_pygamer_asyncio.py +5 -8
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/examples/pybadger_pyportal_touchscreen.py +5 -9
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/examples/pybadger_simpletest.py +2 -6
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/pyproject.toml +2 -2
- adafruit_circuitpython_pybadger-4.0.5/ruff.toml +108 -0
- adafruit_circuitpython_pybadger-4.0.3/.pre-commit-config.yaml +0 -42
- adafruit_circuitpython_pybadger-4.0.3/.pylintrc +0 -399
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/.github/PULL_REQUEST_TEMPLATE/adafruit_circuitpython_pr.md +0 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/.github/workflows/build.yml +0 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/.github/workflows/failure-help-text.yml +0 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/.github/workflows/release_gh.yml +0 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/.github/workflows/release_pypi.yml +0 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/.gitignore +0 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/CODE_OF_CONDUCT.md +0 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/LICENSE +0 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/LICENSES/CC-BY-4.0.txt +0 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/LICENSES/CC-BY-SA-4.0.txt +0 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/LICENSES/MIT.txt +0 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/LICENSES/Unlicense.txt +0 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/README.rst.license +0 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/adafruit_circuitpython_pybadger.egg-info/dependency_links.txt +0 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/adafruit_circuitpython_pybadger.egg-info/requires.txt +0 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/adafruit_circuitpython_pybadger.egg-info/top_level.txt +0 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/adafruit_pybadger/__init__.py +0 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/docs/_static/favicon.ico +0 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/docs/_static/favicon.ico.license +0 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/docs/api.rst.license +0 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/docs/examples.rst +0 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/docs/examples.rst.license +0 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/docs/index.rst +0 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/docs/index.rst.license +0 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/docs/requirements.txt +0 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/examples/Blinka.bmp +0 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/examples/Blinka.bmp.license +0 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/examples/Blinka_CLUE.bmp +0 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/examples/Blinka_CLUE.bmp.license +0 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/examples/Blinka_MagTag.bmp +0 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/examples/Blinka_MagTag.bmp.license +0 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/examples/Blinka_PewPewM4.bmp +0 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/examples/Blinka_PewPewM4.bmp.license +0 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/examples/Blinka_PyPortal.bmp +0 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/examples/Blinka_PyPortal.bmp.license +0 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/examples/QR_Blinka_CircuitPythonOrg.bmp +0 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/examples/QR_Blinka_CircuitPythonOrg.bmp.license +0 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/optional_requirements.txt +0 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/requirements.txt +0 -0
- {adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/setup.cfg +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2024 Justin Myers for Adafruit Industries
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: Unlicense
|
|
4
|
+
|
|
5
|
+
repos:
|
|
6
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
7
|
+
rev: v4.5.0
|
|
8
|
+
hooks:
|
|
9
|
+
- id: check-yaml
|
|
10
|
+
- id: end-of-file-fixer
|
|
11
|
+
- id: trailing-whitespace
|
|
12
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
13
|
+
rev: v0.3.4
|
|
14
|
+
hooks:
|
|
15
|
+
- id: ruff-format
|
|
16
|
+
- id: ruff
|
|
17
|
+
args: ["--fix"]
|
|
18
|
+
- repo: https://github.com/fsfe/reuse-tool
|
|
19
|
+
rev: v3.0.1
|
|
20
|
+
hooks:
|
|
21
|
+
- id: reuse
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: adafruit-circuitpython-pybadger
|
|
3
|
-
Version: 4.0.
|
|
3
|
+
Version: 4.0.5
|
|
4
4
|
Summary: Badge-focused CircuitPython helper library for PyBadge, PyBadge LC, PyGamer and CLUE
|
|
5
5
|
Author-email: Adafruit Industries <circuitpython@adafruit.com>
|
|
6
6
|
License: MIT
|
|
7
|
-
Project-URL: Homepage, https://github.com/adafruit/
|
|
7
|
+
Project-URL: Homepage, https://github.com/adafruit/Adafruit_CircuitPython_PyBadger
|
|
8
8
|
Keywords: adafruit,pybadge,pygamer,clue,display,hardware,micropythoncircuitpython
|
|
9
9
|
Classifier: Intended Audience :: Developers
|
|
10
10
|
Classifier: Topic :: Software Development :: Libraries
|
|
@@ -41,9 +41,9 @@ Introduction
|
|
|
41
41
|
:target: https://github.com/adafruit/Adafruit_CircuitPython_PyBadger/actions/
|
|
42
42
|
:alt: Build Status
|
|
43
43
|
|
|
44
|
-
.. image:: https://img.shields.io/badge/
|
|
45
|
-
:target: https://github.com/
|
|
46
|
-
:alt: Code Style:
|
|
44
|
+
.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
|
|
45
|
+
:target: https://github.com/astral-sh/ruff
|
|
46
|
+
:alt: Code Style: Ruff
|
|
47
47
|
|
|
48
48
|
Badge-focused CircuitPython helper library for PyBadge, PyBadge LC, PyGamer, CLUE, and Mag Tag.
|
|
49
49
|
|
|
@@ -13,9 +13,9 @@ Introduction
|
|
|
13
13
|
:target: https://github.com/adafruit/Adafruit_CircuitPython_PyBadger/actions/
|
|
14
14
|
:alt: Build Status
|
|
15
15
|
|
|
16
|
-
.. image:: https://img.shields.io/badge/
|
|
17
|
-
:target: https://github.com/
|
|
18
|
-
:alt: Code Style:
|
|
16
|
+
.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
|
|
17
|
+
:target: https://github.com/astral-sh/ruff
|
|
18
|
+
:alt: Code Style: Ruff
|
|
19
19
|
|
|
20
20
|
Badge-focused CircuitPython helper library for PyBadge, PyBadge LC, PyGamer, CLUE, and Mag Tag.
|
|
21
21
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: adafruit-circuitpython-pybadger
|
|
3
|
-
Version: 4.0.
|
|
3
|
+
Version: 4.0.5
|
|
4
4
|
Summary: Badge-focused CircuitPython helper library for PyBadge, PyBadge LC, PyGamer and CLUE
|
|
5
5
|
Author-email: Adafruit Industries <circuitpython@adafruit.com>
|
|
6
6
|
License: MIT
|
|
7
|
-
Project-URL: Homepage, https://github.com/adafruit/
|
|
7
|
+
Project-URL: Homepage, https://github.com/adafruit/Adafruit_CircuitPython_PyBadger
|
|
8
8
|
Keywords: adafruit,pybadge,pygamer,clue,display,hardware,micropythoncircuitpython
|
|
9
9
|
Classifier: Intended Audience :: Developers
|
|
10
10
|
Classifier: Topic :: Software Development :: Libraries
|
|
@@ -41,9 +41,9 @@ Introduction
|
|
|
41
41
|
:target: https://github.com/adafruit/Adafruit_CircuitPython_PyBadger/actions/
|
|
42
42
|
:alt: Build Status
|
|
43
43
|
|
|
44
|
-
.. image:: https://img.shields.io/badge/
|
|
45
|
-
:target: https://github.com/
|
|
46
|
-
:alt: Code Style:
|
|
44
|
+
.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
|
|
45
|
+
:target: https://github.com/astral-sh/ruff
|
|
46
|
+
:alt: Code Style: Ruff
|
|
47
47
|
|
|
48
48
|
Badge-focused CircuitPython helper library for PyBadge, PyBadge LC, PyGamer, CLUE, and Mag Tag.
|
|
49
49
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
.gitattributes
|
|
1
2
|
.gitignore
|
|
2
3
|
.pre-commit-config.yaml
|
|
3
|
-
.pylintrc
|
|
4
4
|
.readthedocs.yaml
|
|
5
5
|
CODE_OF_CONDUCT.md
|
|
6
6
|
LICENSE
|
|
@@ -9,6 +9,7 @@ README.rst.license
|
|
|
9
9
|
optional_requirements.txt
|
|
10
10
|
pyproject.toml
|
|
11
11
|
requirements.txt
|
|
12
|
+
ruff.toml
|
|
12
13
|
.github/PULL_REQUEST_TEMPLATE/adafruit_circuitpython_pr.md
|
|
13
14
|
.github/workflows/build.yml
|
|
14
15
|
.github/workflows/failure-help-text.yml
|
|
@@ -26,15 +26,17 @@ Implementation Notes
|
|
|
26
26
|
"""
|
|
27
27
|
|
|
28
28
|
from collections import namedtuple
|
|
29
|
-
|
|
29
|
+
|
|
30
|
+
import adafruit_lsm6ds.lsm6ds3trc
|
|
31
|
+
import adafruit_lsm6ds.lsm6ds33
|
|
30
32
|
import audiopwmio
|
|
33
|
+
import board
|
|
31
34
|
import keypad
|
|
32
|
-
import adafruit_lsm6ds.lsm6ds33
|
|
33
|
-
import adafruit_lsm6ds.lsm6ds3trc
|
|
34
35
|
import neopixel
|
|
35
|
-
from adafruit_pybadger.pybadger_base import PyBadgerBase, KeyStates
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
from adafruit_pybadger.pybadger_base import KeyStates, PyBadgerBase
|
|
38
|
+
|
|
39
|
+
__version__ = "4.0.5"
|
|
38
40
|
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_PyBadger.git"
|
|
39
41
|
|
|
40
42
|
Buttons = namedtuple("Buttons", "a b")
|
|
@@ -84,9 +86,7 @@ class Clue(PyBadgerBase):
|
|
|
84
86
|
print("Button B")
|
|
85
87
|
"""
|
|
86
88
|
self._buttons.update()
|
|
87
|
-
button_values = tuple(
|
|
88
|
-
self._buttons.was_pressed(i) for i in range(self._keys.key_count)
|
|
89
|
-
)
|
|
89
|
+
button_values = tuple(self._buttons.was_pressed(i) for i in range(self._keys.key_count))
|
|
90
90
|
return Buttons(button_values[0], button_values[1])
|
|
91
91
|
|
|
92
92
|
@property
|
|
@@ -101,5 +101,5 @@ class Clue(PyBadgerBase):
|
|
|
101
101
|
light = _unsupported
|
|
102
102
|
|
|
103
103
|
|
|
104
|
-
clue = Clue()
|
|
104
|
+
clue = Clue()
|
|
105
105
|
"""Object that is automatically created on import."""
|
|
@@ -27,19 +27,20 @@ Implementation Notes
|
|
|
27
27
|
"""
|
|
28
28
|
|
|
29
29
|
from collections import namedtuple
|
|
30
|
-
|
|
31
|
-
import
|
|
30
|
+
|
|
31
|
+
import adafruit_lis3dh
|
|
32
32
|
import analogio
|
|
33
|
-
import busio
|
|
34
33
|
import audiopwmio
|
|
34
|
+
import board
|
|
35
|
+
import busio
|
|
36
|
+
import digitalio
|
|
35
37
|
import keypad
|
|
36
|
-
from adafruit_gizmo import tft_gizmo
|
|
37
|
-
import adafruit_lis3dh
|
|
38
38
|
import neopixel
|
|
39
|
-
from
|
|
39
|
+
from adafruit_gizmo import tft_gizmo
|
|
40
40
|
|
|
41
|
+
from adafruit_pybadger.pybadger_base import KeyStates, PyBadgerBase
|
|
41
42
|
|
|
42
|
-
__version__ = "4.0.
|
|
43
|
+
__version__ = "4.0.5"
|
|
43
44
|
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_PyBadger.git"
|
|
44
45
|
|
|
45
46
|
Buttons = namedtuple("Buttons", "a b")
|
|
@@ -91,9 +92,7 @@ class CPB_Gizmo(PyBadgerBase):
|
|
|
91
92
|
print("Button B")
|
|
92
93
|
"""
|
|
93
94
|
self._buttons.update()
|
|
94
|
-
button_values = tuple(
|
|
95
|
-
self._buttons.was_pressed(i) for i in range(self._keys.key_count)
|
|
96
|
-
)
|
|
95
|
+
button_values = tuple(self._buttons.was_pressed(i) for i in range(self._keys.key_count))
|
|
97
96
|
return Buttons(button_values[0], button_values[1])
|
|
98
97
|
|
|
99
98
|
@property
|
|
@@ -106,5 +105,5 @@ class CPB_Gizmo(PyBadgerBase):
|
|
|
106
105
|
# NotImplementedError raised in the property above.
|
|
107
106
|
|
|
108
107
|
|
|
109
|
-
cpb_gizmo = CPB_Gizmo()
|
|
108
|
+
cpb_gizmo = CPB_Gizmo()
|
|
110
109
|
"""Object that is automatically created on import."""
|
|
@@ -26,12 +26,13 @@ Implementation Notes
|
|
|
26
26
|
"""
|
|
27
27
|
|
|
28
28
|
from collections import namedtuple
|
|
29
|
+
|
|
29
30
|
import board
|
|
30
31
|
import neopixel
|
|
31
|
-
from adafruit_pybadger.pybadger_base import PyBadgerBase
|
|
32
32
|
|
|
33
|
+
from adafruit_pybadger.pybadger_base import PyBadgerBase
|
|
33
34
|
|
|
34
|
-
__version__ = "4.0.
|
|
35
|
+
__version__ = "4.0.5"
|
|
35
36
|
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_PyBadger.git"
|
|
36
37
|
|
|
37
38
|
Buttons = namedtuple("Buttons", "a b c d")
|
|
@@ -81,5 +82,5 @@ class MagTag(PyBadgerBase):
|
|
|
81
82
|
button = _unsupported
|
|
82
83
|
|
|
83
84
|
|
|
84
|
-
magtag = MagTag()
|
|
85
|
+
magtag = MagTag()
|
|
85
86
|
"""Object that is automatically created on import."""
|
|
@@ -26,13 +26,14 @@ Implementation Notes
|
|
|
26
26
|
"""
|
|
27
27
|
|
|
28
28
|
from collections import namedtuple
|
|
29
|
-
|
|
29
|
+
|
|
30
30
|
import audioio
|
|
31
|
+
import board
|
|
31
32
|
import keypad
|
|
32
|
-
from adafruit_pybadger.pybadger_base import PyBadgerBase, KeyStates
|
|
33
33
|
|
|
34
|
+
from adafruit_pybadger.pybadger_base import KeyStates, PyBadgerBase
|
|
34
35
|
|
|
35
|
-
__version__ = "4.0.
|
|
36
|
+
__version__ = "4.0.5"
|
|
36
37
|
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_PyBadger.git"
|
|
37
38
|
|
|
38
39
|
Buttons = namedtuple("Buttons", ("o", "x", "z", "right", "down", "up", "left"))
|
|
@@ -80,9 +81,7 @@ class PewPewM4(PyBadgerBase):
|
|
|
80
81
|
print("Button O")
|
|
81
82
|
"""
|
|
82
83
|
self._buttons.update()
|
|
83
|
-
button_values = tuple(
|
|
84
|
-
self._buttons.was_pressed(i) for i in range(self._keys.key_count)
|
|
85
|
-
)
|
|
84
|
+
button_values = tuple(self._buttons.was_pressed(i) for i in range(self._keys.key_count))
|
|
86
85
|
return Buttons(
|
|
87
86
|
button_values[0],
|
|
88
87
|
button_values[1],
|
|
@@ -106,5 +105,5 @@ class PewPewM4(PyBadgerBase):
|
|
|
106
105
|
pixels = _unsupported
|
|
107
106
|
|
|
108
107
|
|
|
109
|
-
pewpewm4 = PewPewM4()
|
|
108
|
+
pewpewm4 = PewPewM4()
|
|
110
109
|
"""Object that is automatically created on import."""
|
|
@@ -31,17 +31,18 @@ Implementation Notes
|
|
|
31
31
|
"""
|
|
32
32
|
|
|
33
33
|
from collections import namedtuple
|
|
34
|
-
|
|
35
|
-
import
|
|
34
|
+
|
|
35
|
+
import adafruit_lis3dh
|
|
36
36
|
import analogio
|
|
37
37
|
import audioio
|
|
38
|
+
import board
|
|
39
|
+
import digitalio
|
|
38
40
|
import keypad
|
|
39
|
-
import adafruit_lis3dh
|
|
40
41
|
import neopixel
|
|
41
|
-
from adafruit_pybadger.pybadger_base import PyBadgerBase, KeyStates
|
|
42
42
|
|
|
43
|
+
from adafruit_pybadger.pybadger_base import KeyStates, PyBadgerBase
|
|
43
44
|
|
|
44
|
-
__version__ = "4.0.
|
|
45
|
+
__version__ = "4.0.5"
|
|
45
46
|
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_PyBadger.git"
|
|
46
47
|
|
|
47
48
|
Buttons = namedtuple("Buttons", "b a start select right down up left")
|
|
@@ -75,12 +76,10 @@ class PyBadge(PyBadgerBase):
|
|
|
75
76
|
break
|
|
76
77
|
|
|
77
78
|
# PyBadge LC doesn't have accelerometer
|
|
78
|
-
if
|
|
79
|
+
if 0x18 in _i2c_devices or 0x19 in _i2c_devices:
|
|
79
80
|
int1 = digitalio.DigitalInOut(board.ACCELEROMETER_INTERRUPT)
|
|
80
81
|
try:
|
|
81
|
-
self._accelerometer = adafruit_lis3dh.LIS3DH_I2C(
|
|
82
|
-
i2c, address=0x19, int1=int1
|
|
83
|
-
)
|
|
82
|
+
self._accelerometer = adafruit_lis3dh.LIS3DH_I2C(i2c, address=0x19, int1=int1)
|
|
84
83
|
except ValueError:
|
|
85
84
|
self._accelerometer = adafruit_lis3dh.LIS3DH_I2C(i2c, int1=int1)
|
|
86
85
|
|
|
@@ -122,9 +121,7 @@ class PyBadge(PyBadgerBase):
|
|
|
122
121
|
|
|
123
122
|
"""
|
|
124
123
|
self._buttons.update()
|
|
125
|
-
button_values = tuple(
|
|
126
|
-
self._buttons.was_pressed(i) for i in range(self._keys.key_count)
|
|
127
|
-
)
|
|
124
|
+
button_values = tuple(self._buttons.was_pressed(i) for i in range(self._keys.key_count))
|
|
128
125
|
return Buttons(
|
|
129
126
|
button_values[0],
|
|
130
127
|
button_values[1],
|
|
@@ -137,5 +134,5 @@ class PyBadge(PyBadgerBase):
|
|
|
137
134
|
)
|
|
138
135
|
|
|
139
136
|
|
|
140
|
-
pybadge = PyBadge()
|
|
137
|
+
pybadge = PyBadge()
|
|
141
138
|
"""Object that is automatically created on import."""
|
|
@@ -29,19 +29,19 @@ Implementation Notes
|
|
|
29
29
|
|
|
30
30
|
from __future__ import annotations
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
import time
|
|
34
32
|
import array
|
|
35
33
|
import math
|
|
34
|
+
import time
|
|
35
|
+
|
|
36
|
+
import adafruit_miniqr
|
|
36
37
|
import board
|
|
37
|
-
from micropython import const
|
|
38
38
|
import digitalio
|
|
39
|
-
from adafruit_bitmap_font import bitmap_font
|
|
40
39
|
import displayio
|
|
40
|
+
import terminalio
|
|
41
|
+
from adafruit_bitmap_font import bitmap_font
|
|
41
42
|
from adafruit_display_shapes.rect import Rect
|
|
42
43
|
from adafruit_display_text import bitmap_label as label
|
|
43
|
-
import
|
|
44
|
-
import adafruit_miniqr
|
|
44
|
+
from micropython import const
|
|
45
45
|
|
|
46
46
|
AUDIO_ENABLED = False
|
|
47
47
|
try:
|
|
@@ -63,15 +63,16 @@ except ImportError:
|
|
|
63
63
|
TYPE_CHECKING = const(0)
|
|
64
64
|
|
|
65
65
|
if TYPE_CHECKING:
|
|
66
|
-
from typing import
|
|
67
|
-
|
|
68
|
-
from adafruit_bitmap_font.
|
|
66
|
+
from typing import Generator, Optional, Union
|
|
67
|
+
|
|
68
|
+
from adafruit_bitmap_font.bdf import BDF
|
|
69
|
+
from adafruit_bitmap_font.pcf import PCF
|
|
69
70
|
from fontio import BuiltinFont
|
|
70
71
|
from keypad import Keys, ShiftRegisterKeys
|
|
71
72
|
from neopixel import NeoPixel
|
|
72
73
|
|
|
73
74
|
|
|
74
|
-
__version__ = "4.0.
|
|
75
|
+
__version__ = "4.0.5"
|
|
75
76
|
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_PyBadger.git"
|
|
76
77
|
|
|
77
78
|
|
|
@@ -87,7 +88,6 @@ def load_font(fontname: str, text: str) -> Union[BDF, PCF]:
|
|
|
87
88
|
return font
|
|
88
89
|
|
|
89
90
|
|
|
90
|
-
# pylint: disable=too-many-instance-attributes
|
|
91
91
|
class PyBadgerBase:
|
|
92
92
|
"""PyBadger base class."""
|
|
93
93
|
|
|
@@ -168,9 +168,7 @@ class PyBadgerBase:
|
|
|
168
168
|
self.root_group = self._background_group
|
|
169
169
|
|
|
170
170
|
if self._background_image_filename:
|
|
171
|
-
file_handle = open(
|
|
172
|
-
self._background_image_filename, "rb"
|
|
173
|
-
)
|
|
171
|
+
file_handle = open(self._background_image_filename, "rb")
|
|
174
172
|
on_disk_bitmap = displayio.OnDiskBitmap(file_handle)
|
|
175
173
|
background_image = displayio.TileGrid(
|
|
176
174
|
on_disk_bitmap,
|
|
@@ -182,8 +180,8 @@ class PyBadgerBase:
|
|
|
182
180
|
|
|
183
181
|
def badge_background(
|
|
184
182
|
self,
|
|
185
|
-
background_color:
|
|
186
|
-
rectangle_color:
|
|
183
|
+
background_color: tuple[int, int, int] = RED,
|
|
184
|
+
rectangle_color: tuple[int, int, int] = WHITE,
|
|
187
185
|
rectangle_drop: float = 0.4,
|
|
188
186
|
rectangle_height: float = 0.5,
|
|
189
187
|
) -> displayio.Group:
|
|
@@ -219,8 +217,8 @@ class PyBadgerBase:
|
|
|
219
217
|
|
|
220
218
|
def _badge_background(
|
|
221
219
|
self,
|
|
222
|
-
background_color:
|
|
223
|
-
rectangle_color:
|
|
220
|
+
background_color: tuple[int, int, int] = RED,
|
|
221
|
+
rectangle_color: tuple[int, int, int] = WHITE,
|
|
224
222
|
rectangle_drop: float = 0.4,
|
|
225
223
|
rectangle_height: float = 0.5,
|
|
226
224
|
) -> displayio.Group:
|
|
@@ -231,9 +229,7 @@ class PyBadgerBase:
|
|
|
231
229
|
color_palette = displayio.Palette(1)
|
|
232
230
|
color_palette[0] = background_color
|
|
233
231
|
|
|
234
|
-
bg_sprite = displayio.TileGrid(
|
|
235
|
-
color_bitmap, pixel_shader=color_palette, x=0, y=0
|
|
236
|
-
)
|
|
232
|
+
bg_sprite = displayio.TileGrid(color_bitmap, pixel_shader=color_palette, x=0, y=0)
|
|
237
233
|
background_group.append(bg_sprite)
|
|
238
234
|
|
|
239
235
|
rectangle = Rect(
|
|
@@ -263,11 +259,10 @@ class PyBadgerBase:
|
|
|
263
259
|
"""
|
|
264
260
|
self._background_image_filename = image_name
|
|
265
261
|
|
|
266
|
-
# pylint: disable=too-many-arguments
|
|
267
262
|
def badge_line(
|
|
268
263
|
self,
|
|
269
264
|
text: str = " ",
|
|
270
|
-
color:
|
|
265
|
+
color: tuple[int, int, int] = BLACK,
|
|
271
266
|
scale: int = 1,
|
|
272
267
|
font: Union[BuiltinFont, BDF, PCF] = terminalio.FONT,
|
|
273
268
|
left_justify: bool = False,
|
|
@@ -361,7 +356,6 @@ class PyBadgerBase:
|
|
|
361
356
|
|
|
362
357
|
self.root_group = self._background_group
|
|
363
358
|
|
|
364
|
-
# pylint: disable=too-many-arguments
|
|
365
359
|
def _create_label_group(
|
|
366
360
|
self,
|
|
367
361
|
text: str,
|
|
@@ -399,10 +393,7 @@ class PyBadgerBase:
|
|
|
399
393
|
self._last_accelerometer = current_accelerometer
|
|
400
394
|
return False
|
|
401
395
|
acceleration_delta = sum(
|
|
402
|
-
(
|
|
403
|
-
abs(self._last_accelerometer[n] - current_accelerometer[n])
|
|
404
|
-
for n in range(3)
|
|
405
|
-
)
|
|
396
|
+
abs(self._last_accelerometer[n] - current_accelerometer[n]) for n in range(3)
|
|
406
397
|
)
|
|
407
398
|
self._last_accelerometer = current_accelerometer
|
|
408
399
|
return acceleration_delta > movement_threshold
|
|
@@ -449,13 +440,9 @@ class PyBadgerBase:
|
|
|
449
440
|
return self._light_sensor.value
|
|
450
441
|
|
|
451
442
|
@property
|
|
452
|
-
def acceleration(self) ->
|
|
443
|
+
def acceleration(self) -> tuple[int, int, int]:
|
|
453
444
|
"""Accelerometer data, +/- 2G sensitivity."""
|
|
454
|
-
return (
|
|
455
|
-
self._accelerometer.acceleration
|
|
456
|
-
if self._accelerometer is not None
|
|
457
|
-
else (0, 0, 0)
|
|
458
|
-
)
|
|
445
|
+
return self._accelerometer.acceleration if self._accelerometer is not None else (0, 0, 0)
|
|
459
446
|
|
|
460
447
|
@property
|
|
461
448
|
def brightness(self) -> float:
|
|
@@ -467,7 +454,6 @@ class PyBadgerBase:
|
|
|
467
454
|
self._display_brightness = value
|
|
468
455
|
self.display.brightness = value
|
|
469
456
|
|
|
470
|
-
# pylint: disable=too-many-locals
|
|
471
457
|
def show_business_card(
|
|
472
458
|
self,
|
|
473
459
|
*,
|
|
@@ -553,24 +539,21 @@ class PyBadgerBase:
|
|
|
553
539
|
business_card_label_groups.append(email_two_group)
|
|
554
540
|
|
|
555
541
|
business_card_splash = displayio.Group()
|
|
556
|
-
image_file = open(image_name, "rb")
|
|
542
|
+
image_file = open(image_name, "rb")
|
|
557
543
|
on_disk_bitmap = displayio.OnDiskBitmap(image_file)
|
|
558
|
-
face_image = displayio.TileGrid(
|
|
559
|
-
on_disk_bitmap, pixel_shader=on_disk_bitmap.pixel_shader
|
|
560
|
-
)
|
|
544
|
+
face_image = displayio.TileGrid(on_disk_bitmap, pixel_shader=on_disk_bitmap.pixel_shader)
|
|
561
545
|
business_card_splash.append(face_image)
|
|
562
546
|
for group in business_card_label_groups:
|
|
563
547
|
business_card_splash.append(group)
|
|
564
548
|
self.root_group = business_card_splash
|
|
565
549
|
|
|
566
|
-
# pylint: disable=too-many-locals
|
|
567
550
|
def show_badge(
|
|
568
551
|
self,
|
|
569
552
|
*,
|
|
570
|
-
background_color:
|
|
571
|
-
foreground_color:
|
|
572
|
-
background_text_color:
|
|
573
|
-
foreground_text_color:
|
|
553
|
+
background_color: tuple[int, int, int] = RED,
|
|
554
|
+
foreground_color: tuple[int, int, int] = WHITE,
|
|
555
|
+
background_text_color: tuple[int, int, int] = WHITE,
|
|
556
|
+
foreground_text_color: tuple[int, int, int] = BLACK,
|
|
574
557
|
hello_font: Union[BuiltinFont, BDF, PCF] = terminalio.FONT,
|
|
575
558
|
hello_scale: int = 1,
|
|
576
559
|
hello_string: str = "HELLO",
|
|
@@ -705,12 +688,8 @@ class PyBadgerBase:
|
|
|
705
688
|
self.display.width // qr_bitmap.width,
|
|
706
689
|
self.display.height // qr_bitmap.height,
|
|
707
690
|
)
|
|
708
|
-
qr_position_x = int(
|
|
709
|
-
|
|
710
|
-
)
|
|
711
|
-
qr_position_y = int(
|
|
712
|
-
((self.display.height / qr_code_scale) - qr_bitmap.height) / 2
|
|
713
|
-
)
|
|
691
|
+
qr_position_x = int(((self.display.width / qr_code_scale) - qr_bitmap.width) / 2)
|
|
692
|
+
qr_position_y = int(((self.display.height / qr_code_scale) - qr_bitmap.height) / 2)
|
|
714
693
|
qr_img = displayio.TileGrid(
|
|
715
694
|
qr_bitmap, pixel_shader=palette, x=qr_position_x, y=qr_position_y
|
|
716
695
|
)
|
|
@@ -730,10 +709,7 @@ class PyBadgerBase:
|
|
|
730
709
|
if self._sample is not None:
|
|
731
710
|
return
|
|
732
711
|
self._sine_wave = array.array("H", PyBadgerBase._sine_sample(length))
|
|
733
|
-
|
|
734
|
-
self._sample = self._audio_out(
|
|
735
|
-
board.SPEAKER
|
|
736
|
-
) # pylint: disable=not-callable
|
|
712
|
+
self._sample = self._audio_out(board.SPEAKER)
|
|
737
713
|
self._sine_wave_sample = audiocore.RawSample(self._sine_wave)
|
|
738
714
|
else:
|
|
739
715
|
print("Required audio modules were missing")
|
|
@@ -791,10 +767,8 @@ class PyBadgerBase:
|
|
|
791
767
|
# Play a specified file.
|
|
792
768
|
self.stop_tone()
|
|
793
769
|
self._enable_speaker(enable=True)
|
|
794
|
-
with self._audio_out(board.SPEAKER) as audio:
|
|
795
|
-
wavefile = audiocore.WaveFile(
|
|
796
|
-
open(file_name, "rb") # pylint: disable=consider-using-with
|
|
797
|
-
)
|
|
770
|
+
with self._audio_out(board.SPEAKER) as audio:
|
|
771
|
+
wavefile = audiocore.WaveFile(open(file_name, "rb"))
|
|
798
772
|
audio.play(wavefile)
|
|
799
773
|
while audio.playing:
|
|
800
774
|
pass
|
|
@@ -26,21 +26,23 @@ Implementation Notes
|
|
|
26
26
|
"""
|
|
27
27
|
|
|
28
28
|
from collections import namedtuple
|
|
29
|
-
|
|
29
|
+
|
|
30
|
+
import adafruit_lis3dh
|
|
30
31
|
import analogio
|
|
31
|
-
import digitalio
|
|
32
32
|
import audioio
|
|
33
|
-
import
|
|
33
|
+
import board
|
|
34
|
+
import digitalio
|
|
34
35
|
import keypad
|
|
35
|
-
import
|
|
36
|
-
|
|
36
|
+
import neopixel
|
|
37
|
+
|
|
38
|
+
from adafruit_pybadger.pybadger_base import KeyStates, PyBadgerBase
|
|
37
39
|
|
|
38
40
|
try:
|
|
39
41
|
from typing import Tuple
|
|
40
42
|
except ImportError:
|
|
41
43
|
pass
|
|
42
44
|
|
|
43
|
-
__version__ = "4.0.
|
|
45
|
+
__version__ = "4.0.5"
|
|
44
46
|
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_PyBadger.git"
|
|
45
47
|
|
|
46
48
|
Buttons = namedtuple("Buttons", "b a start select right down up left")
|
|
@@ -59,9 +61,7 @@ class PyGamer(PyBadgerBase):
|
|
|
59
61
|
|
|
60
62
|
int1 = digitalio.DigitalInOut(board.ACCELEROMETER_INTERRUPT)
|
|
61
63
|
try:
|
|
62
|
-
self._accelerometer = adafruit_lis3dh.LIS3DH_I2C(
|
|
63
|
-
i2c, address=0x19, int1=int1
|
|
64
|
-
)
|
|
64
|
+
self._accelerometer = adafruit_lis3dh.LIS3DH_I2C(i2c, address=0x19, int1=int1)
|
|
65
65
|
except ValueError:
|
|
66
66
|
self._accelerometer = adafruit_lis3dh.LIS3DH_I2C(i2c, int1=int1)
|
|
67
67
|
|
|
@@ -106,9 +106,7 @@ class PyGamer(PyBadgerBase):
|
|
|
106
106
|
|
|
107
107
|
"""
|
|
108
108
|
self._buttons.update()
|
|
109
|
-
button_values = tuple(
|
|
110
|
-
self._buttons.was_pressed(i) for i in range(self._keys.key_count)
|
|
111
|
-
)
|
|
109
|
+
button_values = tuple(self._buttons.was_pressed(i) for i in range(self._keys.key_count))
|
|
112
110
|
x, y = self.joystick
|
|
113
111
|
return Buttons(
|
|
114
112
|
button_values[0],
|
|
@@ -129,5 +127,5 @@ class PyGamer(PyBadgerBase):
|
|
|
129
127
|
return x, y
|
|
130
128
|
|
|
131
129
|
|
|
132
|
-
pygamer = PyGamer()
|
|
130
|
+
pygamer = PyGamer()
|
|
133
131
|
"""Object that is automatically created on import."""
|
|
@@ -24,13 +24,15 @@ Implementation Notes
|
|
|
24
24
|
https://github.com/adafruit/circuitpython/releases
|
|
25
25
|
|
|
26
26
|
"""
|
|
27
|
-
|
|
27
|
+
|
|
28
28
|
import analogio
|
|
29
29
|
import audioio
|
|
30
|
+
import board
|
|
30
31
|
import neopixel
|
|
32
|
+
|
|
31
33
|
from adafruit_pybadger.pybadger_base import PyBadgerBase
|
|
32
34
|
|
|
33
|
-
__version__ = "4.0.
|
|
35
|
+
__version__ = "4.0.5"
|
|
34
36
|
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_PyBadger.git"
|
|
35
37
|
|
|
36
38
|
|
|
@@ -62,5 +64,5 @@ class PyPortal(PyBadgerBase):
|
|
|
62
64
|
auto_dim_display = _unsupported
|
|
63
65
|
|
|
64
66
|
|
|
65
|
-
pyportal = PyPortal()
|
|
67
|
+
pyportal = PyPortal()
|
|
66
68
|
"""Object that is automatically created on import."""
|
{adafruit_circuitpython_pybadger-4.0.3 → adafruit_circuitpython_pybadger-4.0.5}/docs/conf.py
RENAMED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
|
|
3
1
|
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
|
|
4
2
|
#
|
|
5
3
|
# SPDX-License-Identifier: MIT
|
|
6
4
|
|
|
5
|
+
import datetime
|
|
7
6
|
import os
|
|
8
7
|
import sys
|
|
9
|
-
import datetime
|
|
10
8
|
|
|
11
9
|
sys.path.insert(0, os.path.abspath(".."))
|
|
12
10
|
sys.path.insert(0, os.path.abspath("mocks"))
|
|
@@ -64,9 +62,7 @@ project = "Adafruit PyBadger Library"
|
|
|
64
62
|
creation_year = "2019"
|
|
65
63
|
current_year = str(datetime.datetime.now().year)
|
|
66
64
|
year_duration = (
|
|
67
|
-
current_year
|
|
68
|
-
if current_year == creation_year
|
|
69
|
-
else creation_year + " - " + current_year
|
|
65
|
+
current_year if current_year == creation_year else creation_year + " - " + current_year
|
|
70
66
|
)
|
|
71
67
|
copyright = year_duration + " Kattni Rembor"
|
|
72
68
|
author = "Kattni Rembor"
|