Skip to content

Commit

Permalink
Updated for CircuitPython 7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
deckerego committed Oct 5, 2021
1 parent a09c137 commit 0136e4d
Show file tree
Hide file tree
Showing 5 changed files with 185 additions and 24 deletions.
132 changes: 132 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/**/*.mpy
lib/**/*.py
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

.DS_Store
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,21 @@ While the busy indicator is on, you can press the “B” button to decrement th

Pressing the "B" button while idle will change the LED animation cycle to something more interesting or annoying.

## Installing

First make sure that your Circuit Playground Express has the
[latest version of CircuitPython installed](https://circuitpython.org/board/adafruit_macropad_rp2040/).
See [https://learn.adafruit.com/adafruit-circuit-playground-express/circuitpython-quickstart](https://learn.adafruit.com/adafruit-circuit-playground-express/circuitpython-quickstart)
for instructions on how to update the Circuit Playground Express to have the latest version of
CircuitPython.

When installing the Busy/Free Indicator for the first time, extract the latest
[CIRCUITPY.ZIP](https://github.com/deckerego/busy-free_indicator/releases/latest)
into a directory, then copy the contents of that extracted archive
into the CIRCUITPY drive that appears when you plug in your Circuit Playground Express.
Ensure that the contents of the `lib/` subdirectory are also copied - these are
the precompiled Adafruit libraries that power the Playground Express.


## Updating the Software

Expand Down
25 changes: 1 addition & 24 deletions code.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,33 +164,10 @@ def shader_rainbow(frame, timeout_segments):
pixels[pixel] = (204, 61, 61)
return 0.05

def shader_firework(frame, timeout_segments):
color1 = (0, 0, 0)
color2 = (0, 0, 0)

if timeout_segments <= 0:
color1 = (random.randrange(64), random.randrange(96), random.randrange(160))
color2 = (random.randrange(64), random.randrange(96), random.randrange(160))
else:
color1 = (64 + random.randrange(164), random.randrange(24), random.randrange(64))
color2 = (64 + random.randrange(164), random.randrange(24), random.randrange(64))

if frame % 2 is 0:
for pixel in range(timeout_segments, 10):
if timeout_segments > 0 or frame > 2:
gamma = 1 - LOG_10[frame - 1]
color = color1 if pixel % 2 is 0 else color2
pixels[pixel] = list(map(lambda c: math.ceil(gamma * c), color))
else:
pixels[pixel] = (0, 0, 0)
for pixel in range(timeout_segments):
pixels[pixel] = (248, 0, 0)
return 0.05

# Constants
SECONDS_PER_CLICK = 900
LOG_10 = [0.0, 0.3010, 0.4771, 0.6021, 0.6990, 0.7782, 0.8451, 0.9031, 0.9542, 1.0]
SHADERS = [shader_rotate, shader_breathe, shader_sparkle, shader_rainbow, shader_firework]
SHADERS = [shader_rotate, shader_breathe, shader_sparkle, shader_rainbow]

# Default state
power = switch_state
Expand Down
21 changes: 21 additions & 0 deletions lib/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2019 Limor Fried for Adafruit Industries

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
16 changes: 16 additions & 0 deletions lib/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Adafruit Macropad Libraries

These MicroPython compiled libraries are provided as a convenience when
installing this version of the Busy/Free Indicator.

If you are installing straight from this repository, you can download the
libraries as a bundle from the
[CircuitPython library bundle](https://circuitpython.org/libraries).

The libraries required by this version of Macropad Hotkeys includes:
- adafruit_lis3dh.mpy
- simpleio.mpy

These libraries are individually licensed in each of their GitHub repositories
and are provided by Adafruit under the MIT license
(see also [LICENSE](./LICENSE) in this directory)

0 comments on commit 0136e4d

Please sign in to comment.