Skip to content

Allow access to eighth sequence slot #28

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 1 commit into from
Jan 11, 2022
Merged
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
14 changes: 7 additions & 7 deletions adafruit_drv2605.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def library(self, val):
@property
def sequence(self):
"""List-like sequence of waveform effects.
Get or set an effect waveform for slot 0-6 by indexing the sequence
Get or set an effect waveform for slot 0-7 by indexing the sequence
property with the slot number. A slot must be set to either an Effect()
or Pause() class. See the datasheet for a complete table of effect ID
values and the associated waveform / effect.
Expand All @@ -192,14 +192,14 @@ def sequence(self):

def set_waveform(self, effect_id, slot=0):
"""Select an effect waveform for the specified slot (default is slot 0,
but up to 7 effects can be combined with slot values 0 to 6). See the
but up to 8 effects can be combined with slot values 0 to 7). See the
datasheet for a complete table of effect ID values and the associated
waveform / effect.
"""
if not 0 <= effect_id <= 123:
raise ValueError("Effect ID must be a value within 0-123!")
if not 0 <= slot <= 6:
raise ValueError("Slot must be a value within 0-6!")
if not 0 <= slot <= 7:
raise ValueError("Slot must be a value within 0-7!")
self._write_u8(_DRV2605_REG_WAVESEQ1 + slot, effect_id)

# pylint: disable=invalid-name
Expand Down Expand Up @@ -285,7 +285,7 @@ def __init__(self, DRV2605_instance):

def __setitem__(self, slot, effect):
"""Write an Effect or Pause to a slot."""
if not 0 <= slot <= 6:
if not 0 <= slot <= 7:
raise IndexError("Slot must be a value within 0-6!")
if not isinstance(effect, (Effect, Pause)):
raise TypeError("Effect must be either an Effect() or Pause()!")
Expand All @@ -294,7 +294,7 @@ def __setitem__(self, slot, effect):

def __getitem__(self, slot):
"""Read an effect ID from a slot. Returns either a Pause or Effect class."""
if not 0 <= slot <= 6:
if not 0 <= slot <= 7:
raise IndexError("Slot must be a value within 0-6!")
# pylint: disable=protected-access
slot_contents = self._drv2605._read_u8(_DRV2605_REG_WAVESEQ1 + slot)
Expand All @@ -304,7 +304,7 @@ def __getitem__(self, slot):

def __iter__(self):
"""Returns an iterator over the waveform sequence slots."""
for slot in range(0, 7):
for slot in range(0, 8):
yield self[slot]

def __repr__(self):
Expand Down