Skip to content

Updating examples and readme #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Oct 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

repos:
- repo: https://github.com/python/black
rev: latest
rev: 19.10b0
hooks:
- id: black
- repo: https://github.com/fsfe/reuse-tool
Expand Down
3 changes: 3 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ This driver depends on:
* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_
* `Bus Device <https://github.com/adafruit/Adafruit_CircuitPython_BusDevice>`_
* `Register <https://github.com/adafruit/Adafruit_CircuitPython_Register>`_
* `Seesaw <https://github.com/adafruit/Adafruit_CircuitPython_seesaw>`_
* `LIS3DH <https://github.com/adafruit/Adafruit_CircuitPython_LIS3DH>`_
* `ST7789 <https://github.com/adafruit/Adafruit_CircuitPython_ST7789>`_

Please ensure all dependencies are available on the CircuitPython filesystem.
This is easily achieved by downloading
Expand Down
33 changes: 19 additions & 14 deletions adafruit_monsterm4sk.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# SPDX-FileCopyrightText: 2020 Foamyguy, written for Adafruit Industries
# SPDX-FileCopyrightText: Copyright (c) 2020 Foamyguy for Adafruit Industries
#
# SPDX-License-Identifier: MIT
Expand All @@ -16,8 +15,7 @@

**Hardware:**

* `MONSTER M4SK <https://www.adafruit.com/product/4343>`

* `MONSTER M4SK <https://www.adafruit.com/product/4343>`_

**Software and Dependencies:**

Expand All @@ -30,15 +28,15 @@
"""

# imports
import time
import board
import pulseio
import busio
import displayio
import time
import touchio
import digitalio
from adafruit_seesaw.seesaw import Seesaw
import displayio
import touchio
from adafruit_st7789 import ST7789
import pulseio
import adafruit_lis3dh

__version__ = "0.0.0-auto.0"
Expand All @@ -54,10 +52,10 @@


class MonsterM4sk:
"""Class representing a `MONSTER M4SK`
<https://www.adafruit.com/product/4343>`_.
"""Represents a single Monster M4sk

The terms "left" and "right" are always used from the perspective of looking out of the mask.
The terms "left" and "right" are always used from the
perspective of looking out of the mask.
The right screen is the one USB port directly above it.
"""

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

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

self.right_backlight = pulseio.PWMOut(board.RIGHT_TFT_LITE, frequency=5000, duty_cycle=0)
self.right_backlight = pulseio.PWMOut(
board.RIGHT_TFT_LITE, frequency=5000, duty_cycle=0
)
self.right_backlight.duty_cycle = 65535

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

right_display_bus = displayio.FourWire(
right_spi, command=right_tft_dc, chip_select=right_tft_cs, reset=board.RIGHT_TFT_RST
right_spi,
command=right_tft_dc,
chip_select=right_tft_cs,
reset=board.RIGHT_TFT_RST,
)

self.right_display = ST7789(right_display_bus, width=240, height=240, rowstart=80)
self.right_display = ST7789(
right_display_bus, width=240, height=240, rowstart=80
)

if i2c is not None:
int1 = digitalio.DigitalInOut(board.ACCELEROMETER_INTERRUPT)
Expand Down Expand Up @@ -146,7 +151,7 @@ def buttons(self):
return {
"S9": self._ss.digital_read(SS_SWITCH1_PIN) is False,
"S10": self._ss.digital_read(SS_SWITCH2_PIN) is False,
"S11": self._ss.digital_read(SS_SWITCH3_PIN) is False
"S11": self._ss.digital_read(SS_SWITCH3_PIN) is False,
}

@property
Expand Down
22 changes: 19 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,28 @@
# Uncomment the below if you use native CircuitPython modules such as
# digitalio, micropython and busio. List the modules you use. Without it, the
# autodoc module docs will fail to generate with a warning.
# autodoc_mock_imports = ["digitalio", "busio"]
autodoc_mock_imports = [
"digitalio",
"busio",
"pulseio",
"displayio",
"touchio",
"adafruit_st7789",
"adafruit_seesaw",
"adafruit_lis3dh",
]


intersphinx_mapping = {
"python": ("https://docs.python.org/3.4", None),"BusDevice": ("https://circuitpython.readthedocs.io/projects/busdevice/en/latest/", None),
"Register": ("https://circuitpython.readthedocs.io/projects/register/en/latest/", None),
"python": ("https://docs.python.org/3.4", None),
"BusDevice": (
"https://circuitpython.readthedocs.io/projects/busdevice/en/latest/",
None,
),
"Register": (
"https://circuitpython.readthedocs.io/projects/register/en/latest/",
None,
),
"CircuitPython": ("https://circuitpython.readthedocs.io/en/latest/", None),
}

Expand Down
6 changes: 1 addition & 5 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,10 @@ Table of Contents
.. toctree::
:caption: Tutorials

.. todo:: Add any Learn guide links here. If there are none, then simply delete this todo and leave
the toctree above for use later.

.. toctree::
:caption: Related Products

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

.. toctree::
:caption: Other Links
Expand Down
47 changes: 30 additions & 17 deletions examples/monsterm4sk_rainbow_stars.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
make the eyes change through the rainbow.
"""

import time
import board
import displayio
import adafruit_monsterm4sk
import adafruit_imageload
import time
import adafruit_monsterm4sk


SCREEN_SIZE = 240
IMAGE_SIZE = 64 * 3
Expand All @@ -36,21 +37,33 @@
right_group.y = (SCREEN_SIZE - IMAGE_SIZE) // 2

# load in party parrot bitmap
parrot_bit, parrot_pal = adafruit_imageload.load("/rainbow_star.bmp",
bitmap=displayio.Bitmap,
palette=displayio.Palette)

right_star_grid = displayio.TileGrid(parrot_bit, pixel_shader=parrot_pal,
width=1, height=1,
tile_height=64, tile_width=64,
default_tile=0,
x=0, y=0)

left_star_grid = displayio.TileGrid(parrot_bit, pixel_shader=parrot_pal,
width=1, height=1,
tile_height=64, tile_width=64,
default_tile=0,
x=0, y=0)
star_bitmap, star_palette = adafruit_imageload.load(
"/rainbow_star.bmp", bitmap=displayio.Bitmap, palette=displayio.Palette
)

right_star_grid = displayio.TileGrid(
star_bitmap,
pixel_shader=star_palette,
width=1,
height=1,
tile_height=64,
tile_width=64,
default_tile=0,
x=0,
y=0,
)

left_star_grid = displayio.TileGrid(
star_bitmap,
pixel_shader=star_palette,
width=1,
height=1,
tile_height=64,
tile_width=64,
default_tile=0,
x=0,
y=0,
)

right_group.append(right_star_grid)
left_group.append(left_star_grid)
Expand Down
3 changes: 3 additions & 0 deletions examples/rainbow_star.bmp.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-FileCopyrightText: 2020 Foamyguy, created for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
],
# What does your project relate to?
keywords="adafruit blinka circuitpython micropython monsterm4sk dualscreen bothscreens "
"monster_m4sk",
"monster_m4sk",
# You can just specify the packages manually here if your project is
# simple. Or you can use find_packages().
# TODO: IF LIBRARY FILES ARE A PACKAGE FOLDER,
Expand Down