Skip to content
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

Return from fade on "None" #53

Merged
merged 8 commits into from
Feb 22, 2023
Merged
Show file tree
Hide file tree
Changes from 7 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ _build
# Virtual environment-specific files
.env
.venv
venv

# MacOS-specific files
*.DS_Store
Expand Down
7 changes: 4 additions & 3 deletions adafruit_is31fl3731/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

Base library.

* Author(s): Tony DiCola, Melissa LeBlanc-Williams, David Glaude
* Author(s): Tony DiCola, Melissa LeBlanc-Williams, David Glaude, E. A. Graham Jr.

Implementation Notes
--------------------
Expand Down Expand Up @@ -190,7 +190,7 @@ def autoplay(self, delay=0, loops=0, frames=0):
self._register(_CONFIG_BANK, _AUTOPLAY2_REGISTER, delay % 64)
self._mode(_AUTOPLAY_MODE | self._frame)

def fade(self, fade_in=None, fade_out=None, pause=0):
def fade(self, fade_in=None, fade_out=None, pause=26):
tannewt marked this conversation as resolved.
Show resolved Hide resolved
"""
Start and stop the fade feature. If both fade_in and fade_out are None (the
default), the breath feature is used for fading. if fade_in is None, then
Expand All @@ -202,7 +202,8 @@ def fade(self, fade_in=None, fade_out=None, pause=0):
"""
if fade_in is None and fade_out is None:
self._register(_CONFIG_BANK, _BREATH2_REGISTER, 0)
elif fade_in is None:
return
if fade_in is None:
fade_in = fade_out
elif fade_out is None:
fade_out = fade_in
Expand Down
24 changes: 24 additions & 0 deletions examples/is31fl3731_ledshim_fade.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT

import time
import board
import busio
from adafruit_is31fl3731.led_shim import LedShim as Display

i2c = busio.I2C(board.SCL, board.SDA)

# initial display if you are using Pimoroni LED SHIM
display = Display(i2c)

y = 1
for x in range(28):
display.pixel(x, y, 255)

display.fade(fade_in=104, pause=250)

try:
while True:
time.sleep(10)
except KeyboardInterrupt:
display.sleep(True)