File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 63
63
_UNSTABLE_STATE = const (0x02 )
64
64
_CHANGED_STATE = const (0x04 )
65
65
66
+
67
+ # Find out whether the current CircuitPython supports time.monotonic_ns(),
68
+ # which doesn't have the accuracy limitation.
66
69
if hasattr (time , 'monotonic_ns' ):
67
- INTERVAL_FACTOR = 1_000_000_000
70
+ MONOTONIC_UNITS_PER_SEC = 1_000_000_000
68
71
MONOTONIC_TIME = time .monotonic_ns
69
72
else :
70
- INTERVAL_FACTOR = 1
73
+ MONOTONIC_UNITS_PER_SEC = 1
71
74
MONOTONIC_TIME = time .monotonic
72
75
73
76
@@ -123,12 +126,13 @@ def update(self):
123
126
124
127
@property
125
128
def interval (self ):
126
- return self ._interval / INTERVAL_FACTOR
129
+ """The debounce delay, in seconds"""
130
+ return self ._interval / MONOTONIC_UNITS_PER_SEC
127
131
128
132
129
133
@interval .setter
130
134
def interval (self , new_interval_s ):
131
- self ._interval = new_interval_s * INTERVAL_FACTOR
135
+ self ._interval = new_interval_s * MONOTONIC_UNITS_PER_SEC
132
136
133
137
134
138
@property
You can’t perform that action at this time.
0 commit comments