Skip to content

Commit 92b9af4

Browse files
authored
Merge pull request #25 from tekktrik/dev/convert-to-properties
Breaking changes to conform to design guide
2 parents cf51ea2 + dc135ac commit 92b9af4

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

adafruit_vc0706.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -221,22 +221,21 @@ def read_picture_into(self, buf: circuitpython_typing.WriteableBuffer) -> int:
221221
buf[i] = self._buffer[i]
222222
return n
223223

224+
@property
224225
def motion_detected(self) -> bool:
225-
"""Read the gesture detection result"""
226+
"""Whether a gesture was detected"""
226227
self._read_response(self._buffer, len(self._buffer))
227228
if not self._verify_response(_COMM_MOTION_DETECTED):
228229
return False
229230
return True
230231

231-
def get_motion_detect(self) -> bool:
232-
"""Query the gesture detection status"""
232+
@property
233+
def motion_detection(self) -> bool:
234+
"""The gesture detection status"""
233235
return self._run_command(_COMM_MOTION_STATUS, bytes([0x00]), 6)
234236

235-
def set_motion_detect(self, enabled: bool) -> bool:
236-
"""Set gesture detection status.
237-
238-
:param bool enabled: False to disable motion detected, True to enable motion detection.
239-
"""
237+
@motion_detection.setter
238+
def motion_detection(self, enabled: bool) -> bool:
240239
return self._run_command(_COMM_MOTION_CTRL, bytes([0x01, enabled]), 5)
241240

242241
def _run_command(

0 commit comments

Comments
 (0)