Skip to content

Commit 32ae578

Browse files
authored
Merge pull request #28 from tekktrik/feature/add-eight-slot
Allow access to eighth sequence slot
2 parents b0786b5 + e4c38d8 commit 32ae578

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

adafruit_drv2605.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def library(self, val):
181181
@property
182182
def sequence(self):
183183
"""List-like sequence of waveform effects.
184-
Get or set an effect waveform for slot 0-6 by indexing the sequence
184+
Get or set an effect waveform for slot 0-7 by indexing the sequence
185185
property with the slot number. A slot must be set to either an Effect()
186186
or Pause() class. See the datasheet for a complete table of effect ID
187187
values and the associated waveform / effect.
@@ -192,14 +192,14 @@ def sequence(self):
192192

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

205205
# pylint: disable=invalid-name
@@ -285,7 +285,7 @@ def __init__(self, DRV2605_instance):
285285

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

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

305305
def __iter__(self):
306306
"""Returns an iterator over the waveform sequence slots."""
307-
for slot in range(0, 7):
307+
for slot in range(0, 8):
308308
yield self[slot]
309309

310310
def __repr__(self):

0 commit comments

Comments
 (0)