Skip to content

Commit c1a98b6

Browse files
authored
Merge pull request #1 from FoamyGuy/main
Updating examples and readme
2 parents 75b35e2 + 9e83b89 commit c1a98b6

File tree

8 files changed

+77
-41
lines changed

8 files changed

+77
-41
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
repos:
66
- repo: https://github.com/python/black
7-
rev: latest
7+
rev: 19.10b0
88
hooks:
99
- id: black
1010
- repo: https://github.com/fsfe/reuse-tool

README.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ This driver depends on:
2727
* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_
2828
* `Bus Device <https://github.com/adafruit/Adafruit_CircuitPython_BusDevice>`_
2929
* `Register <https://github.com/adafruit/Adafruit_CircuitPython_Register>`_
30+
* `Seesaw <https://github.com/adafruit/Adafruit_CircuitPython_seesaw>`_
31+
* `LIS3DH <https://github.com/adafruit/Adafruit_CircuitPython_LIS3DH>`_
32+
* `ST7789 <https://github.com/adafruit/Adafruit_CircuitPython_ST7789>`_
3033

3134
Please ensure all dependencies are available on the CircuitPython filesystem.
3235
This is easily achieved by downloading

adafruit_monsterm4sk.py

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# SPDX-FileCopyrightText: 2020 Foamyguy, written for Adafruit Industries
21
# SPDX-FileCopyrightText: Copyright (c) 2020 Foamyguy for Adafruit Industries
32
#
43
# SPDX-License-Identifier: MIT
@@ -16,8 +15,7 @@
1615
1716
**Hardware:**
1817
19-
* `MONSTER M4SK <https://www.adafruit.com/product/4343>`
20-
18+
* `MONSTER M4SK <https://www.adafruit.com/product/4343>`_
2119
2220
**Software and Dependencies:**
2321
@@ -30,15 +28,15 @@
3028
"""
3129

3230
# imports
31+
import time
3332
import board
33+
import pulseio
3434
import busio
35-
import displayio
36-
import time
37-
import touchio
3835
import digitalio
3936
from adafruit_seesaw.seesaw import Seesaw
37+
import displayio
38+
import touchio
4039
from adafruit_st7789 import ST7789
41-
import pulseio
4240
import adafruit_lis3dh
4341

4442
__version__ = "0.0.0-auto.0"
@@ -54,10 +52,10 @@
5452

5553

5654
class MonsterM4sk:
57-
"""Class representing a `MONSTER M4SK`
58-
<https://www.adafruit.com/product/4343>`_.
55+
"""Represents a single Monster M4sk
5956
60-
The terms "left" and "right" are always used from the perspective of looking out of the mask.
57+
The terms "left" and "right" are always used from the
58+
perspective of looking out of the mask.
6159
The right screen is the one USB port directly above it.
6260
"""
6361

@@ -99,7 +97,9 @@ def __init__(self, i2c=None):
9997

10098
self.left_display = ST7789(left_display_bus, width=240, height=240, rowstart=80)
10199

102-
self.right_backlight = pulseio.PWMOut(board.RIGHT_TFT_LITE, frequency=5000, duty_cycle=0)
100+
self.right_backlight = pulseio.PWMOut(
101+
board.RIGHT_TFT_LITE, frequency=5000, duty_cycle=0
102+
)
103103
self.right_backlight.duty_cycle = 65535
104104

105105
# right display
@@ -108,10 +108,15 @@ def __init__(self, i2c=None):
108108
right_tft_dc = board.RIGHT_TFT_DC
109109

110110
right_display_bus = displayio.FourWire(
111-
right_spi, command=right_tft_dc, chip_select=right_tft_cs, reset=board.RIGHT_TFT_RST
111+
right_spi,
112+
command=right_tft_dc,
113+
chip_select=right_tft_cs,
114+
reset=board.RIGHT_TFT_RST,
112115
)
113116

114-
self.right_display = ST7789(right_display_bus, width=240, height=240, rowstart=80)
117+
self.right_display = ST7789(
118+
right_display_bus, width=240, height=240, rowstart=80
119+
)
115120

116121
if i2c is not None:
117122
int1 = digitalio.DigitalInOut(board.ACCELEROMETER_INTERRUPT)
@@ -146,7 +151,7 @@ def buttons(self):
146151
return {
147152
"S9": self._ss.digital_read(SS_SWITCH1_PIN) is False,
148153
"S10": self._ss.digital_read(SS_SWITCH2_PIN) is False,
149-
"S11": self._ss.digital_read(SS_SWITCH3_PIN) is False
154+
"S11": self._ss.digital_read(SS_SWITCH3_PIN) is False,
150155
}
151156

152157
@property

docs/conf.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,28 @@
2525
# Uncomment the below if you use native CircuitPython modules such as
2626
# digitalio, micropython and busio. List the modules you use. Without it, the
2727
# autodoc module docs will fail to generate with a warning.
28-
# autodoc_mock_imports = ["digitalio", "busio"]
28+
autodoc_mock_imports = [
29+
"digitalio",
30+
"busio",
31+
"pulseio",
32+
"displayio",
33+
"touchio",
34+
"adafruit_st7789",
35+
"adafruit_seesaw",
36+
"adafruit_lis3dh",
37+
]
2938

3039

3140
intersphinx_mapping = {
32-
"python": ("https://docs.python.org/3.4", None),"BusDevice": ("https://circuitpython.readthedocs.io/projects/busdevice/en/latest/", None),
33-
"Register": ("https://circuitpython.readthedocs.io/projects/register/en/latest/", None),
41+
"python": ("https://docs.python.org/3.4", None),
42+
"BusDevice": (
43+
"https://circuitpython.readthedocs.io/projects/busdevice/en/latest/",
44+
None,
45+
),
46+
"Register": (
47+
"https://circuitpython.readthedocs.io/projects/register/en/latest/",
48+
None,
49+
),
3450
"CircuitPython": ("https://circuitpython.readthedocs.io/en/latest/", None),
3551
}
3652

docs/index.rst

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,10 @@ Table of Contents
2323
.. toctree::
2424
:caption: Tutorials
2525

26-
.. todo:: Add any Learn guide links here. If there are none, then simply delete this todo and leave
27-
the toctree above for use later.
28-
2926
.. toctree::
3027
:caption: Related Products
3128

32-
.. todo:: Add any product links here. If there are none, then simply delete this todo and leave
33-
the toctree above for use later.
29+
MONSTER M4SK <https://www.adafruit.com/product/4343>
3430

3531
.. toctree::
3632
:caption: Other Links

examples/monsterm4sk_rainbow_stars.py

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@
1010
make the eyes change through the rainbow.
1111
"""
1212

13+
import time
1314
import board
1415
import displayio
15-
import adafruit_monsterm4sk
1616
import adafruit_imageload
17-
import time
17+
import adafruit_monsterm4sk
18+
1819

1920
SCREEN_SIZE = 240
2021
IMAGE_SIZE = 64 * 3
@@ -36,21 +37,33 @@
3637
right_group.y = (SCREEN_SIZE - IMAGE_SIZE) // 2
3738

3839
# load in party parrot bitmap
39-
parrot_bit, parrot_pal = adafruit_imageload.load("/rainbow_star.bmp",
40-
bitmap=displayio.Bitmap,
41-
palette=displayio.Palette)
42-
43-
right_star_grid = displayio.TileGrid(parrot_bit, pixel_shader=parrot_pal,
44-
width=1, height=1,
45-
tile_height=64, tile_width=64,
46-
default_tile=0,
47-
x=0, y=0)
48-
49-
left_star_grid = displayio.TileGrid(parrot_bit, pixel_shader=parrot_pal,
50-
width=1, height=1,
51-
tile_height=64, tile_width=64,
52-
default_tile=0,
53-
x=0, y=0)
40+
star_bitmap, star_palette = adafruit_imageload.load(
41+
"/rainbow_star.bmp", bitmap=displayio.Bitmap, palette=displayio.Palette
42+
)
43+
44+
right_star_grid = displayio.TileGrid(
45+
star_bitmap,
46+
pixel_shader=star_palette,
47+
width=1,
48+
height=1,
49+
tile_height=64,
50+
tile_width=64,
51+
default_tile=0,
52+
x=0,
53+
y=0,
54+
)
55+
56+
left_star_grid = displayio.TileGrid(
57+
star_bitmap,
58+
pixel_shader=star_palette,
59+
width=1,
60+
height=1,
61+
tile_height=64,
62+
tile_width=64,
63+
default_tile=0,
64+
x=0,
65+
y=0,
66+
)
5467

5568
right_group.append(right_star_grid)
5669
left_group.append(left_star_grid)

examples/rainbow_star.bmp.license

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# SPDX-FileCopyrightText: 2020 Foamyguy, created for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: Unlicense

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
],
5757
# What does your project relate to?
5858
keywords="adafruit blinka circuitpython micropython monsterm4sk dualscreen bothscreens "
59-
"monster_m4sk",
59+
"monster_m4sk",
6060
# You can just specify the packages manually here if your project is
6161
# simple. Or you can use find_packages().
6262
# TODO: IF LIBRARY FILES ARE A PACKAGE FOLDER,

0 commit comments

Comments
 (0)