From 9f005211e2914e168936faffc0cee6867777703b Mon Sep 17 00:00:00 2001 From: Alec Delaney Date: Wed, 12 Jan 2022 09:39:14 -0500 Subject: [PATCH 1/3] Fix code block formatting --- adafruit_drv2605.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/adafruit_drv2605.py b/adafruit_drv2605.py index 1db13c1..6c45612 100644 --- a/adafruit_drv2605.py +++ b/adafruit_drv2605.py @@ -197,13 +197,12 @@ def sequence(self) -> "_DRV2605_Sequence": values and the associated waveform / effect. E.g.: + .. code-block:: python # Getting the effect stored in a slot slot_0_effect = drv.sequence[0] - .. code-block:: python - # Setting an Effect in the first sequence slot drv.sequence[0] = Effect(88) """ From e71dd6b408c284e1601e9059fb1d6cd89ed542f7 Mon Sep 17 00:00:00 2001 From: Alec Delaney Date: Wed, 12 Jan 2022 09:43:56 -0500 Subject: [PATCH 2/3] Update references to say 8 slots --- adafruit_drv2605.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/adafruit_drv2605.py b/adafruit_drv2605.py index 6c45612..b4cbcf5 100644 --- a/adafruit_drv2605.py +++ b/adafruit_drv2605.py @@ -191,7 +191,7 @@ def library(self, val: int) -> None: @property def sequence(self) -> "_DRV2605_Sequence": """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 :class:`~Effect` or :class:`~Pause` class. See the datasheet for a complete table of effect ID values and the associated waveform / effect. @@ -316,7 +316,7 @@ def __init__(self, DRV2605_instance: DRV2605) -> None: def __setitem__(self, slot: int, effect: Union[Effect, Pause]) -> None: """Write an Effect or Pause to a slot.""" if not 0 <= slot <= 7: - raise IndexError("Slot must be a value within 0-6!") + raise IndexError("Slot must be a value within 0-7!") if not isinstance(effect, (Effect, Pause)): raise TypeError("Effect must be either an Effect() or Pause()!") # pylint: disable=protected-access @@ -325,7 +325,7 @@ def __setitem__(self, slot: int, effect: Union[Effect, Pause]) -> None: def __getitem__(self, slot: int) -> Union[Effect, Pause]: """Read an effect ID from a slot. Returns either a Pause or Effect class.""" if not 0 <= slot <= 7: - raise IndexError("Slot must be a value within 0-6!") + raise IndexError("Slot must be a value within 0-7!") # pylint: disable=protected-access slot_contents = self._drv2605._read_u8(_DRV2605_REG_WAVESEQ1 + slot) if slot_contents & 0x80: From 7dea3daea46e087ab48417dc149fdc4c452efc38 Mon Sep 17 00:00:00 2001 From: Alec Delaney Date: Wed, 12 Jan 2022 09:44:27 -0500 Subject: [PATCH 3/3] Remove () from class references --- adafruit_drv2605.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adafruit_drv2605.py b/adafruit_drv2605.py index b4cbcf5..964d54a 100644 --- a/adafruit_drv2605.py +++ b/adafruit_drv2605.py @@ -318,7 +318,7 @@ def __setitem__(self, slot: int, effect: Union[Effect, Pause]) -> None: if not 0 <= slot <= 7: raise IndexError("Slot must be a value within 0-7!") if not isinstance(effect, (Effect, Pause)): - raise TypeError("Effect must be either an Effect() or Pause()!") + raise TypeError("Effect must be either an Effect or Pause!") # pylint: disable=protected-access self._drv2605._write_u8(_DRV2605_REG_WAVESEQ1 + slot, effect.raw_value)