Skip to content

Commit b392639

Browse files
committed
raise Value error if invalid rotation value is supplied. Indicate acceptable values in docstring.
1 parent b3a5a36 commit b392639

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

adafruit_apds9960/apds9960.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,15 @@ def _reset_counts(self):
180180
## GESTURE ROTATION
181181
@property
182182
def rotation(self):
183-
"""Gesture rotation offset"""
183+
"""Gesture rotation offset. Acceptable values are 0, 90, 180, 270."""
184184
return self._rotation
185185

186186
@rotation.setter
187187
def rotation(self, new_rotation):
188188
if new_rotation in [0, 90, 180, 270]:
189189
self._rotation = new_rotation
190+
else:
191+
raise ValueError("Rotation value must be one of: 0, 90, 180, 270")
190192

191193
## GESTURE DETECTION
192194
@property

0 commit comments

Comments
 (0)