Skip to content
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

Tap matching #96

Merged
merged 6 commits into from
Jul 17, 2020
Merged
Changes from 5 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
29 changes: 21 additions & 8 deletions adafruit_circuitplayground/circuit_playground_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import audiocore
except ImportError:
import audioio as audiocore
import os
import analogio
import board
import busio
Expand Down Expand Up @@ -162,14 +163,26 @@ def detect_taps(self):
@detect_taps.setter
def detect_taps(self, value):
self._detect_taps = value
if value == 1:
self._lis3dh.set_tap(
value, 90, time_limit=4, time_latency=50, time_window=255
)
if value == 2:
self._lis3dh.set_tap(
value, 60, time_limit=10, time_latency=50, time_window=255
)
if (
"nRF52840" in os.uname().machine
): # If we're on a CPB, use a higher tap threshold
if value == 1:
self._lis3dh.set_tap(
value, 100, time_limit=4, time_latency=50, time_window=255
)
if value == 2:
self._lis3dh.set_tap(
value, 70, time_limit=10, time_latency=50, time_window=255
)
else: # If we're on a CPX or CPC
evaherrada marked this conversation as resolved.
Show resolved Hide resolved
if value == 1:
self._lis3dh.set_tap(
value, 90, time_limit=4, time_latency=50, time_window=255
)
if value == 2:
self._lis3dh.set_tap(
value, 60, time_limit=10, time_latency=50, time_window=255
)

@property
def tapped(self):
Expand Down