Skip to content

Commit

Permalink
Merge pull request #24 from dglaude/patch-1
Browse files Browse the repository at this point in the history
Update adafruit_debouncer.py
  • Loading branch information
jepler committed Sep 14, 2020
2 parents 5e5e302 + 62eb982 commit 3569774
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions adafruit_debouncer.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,13 @@
_UNSTABLE_STATE = const(0x02)
_CHANGED_STATE = const(0x04)

# Find out whether the current CircuitPython supports time.monotonic_ns(),
# Find out whether the current CircuitPython really supports time.monotonic_ns(),
# which doesn't have the accuracy limitation.
if hasattr(time, "monotonic_ns"):
try:
time.monotonic_ns()
TICKS_PER_SEC = 1_000_000_000
MONOTONIC_TICKS = time.monotonic_ns
else:
except (AttributeError, NotImplementedError):
TICKS_PER_SEC = 1
MONOTONIC_TICKS = time.monotonic

Expand Down

0 comments on commit 3569774

Please sign in to comment.