@@ -113,10 +113,7 @@ def __init__(self):
113
113
# Define acceleration:
114
114
self ._i2c = busio .I2C (board .ACCELEROMETER_SCL , board .ACCELEROMETER_SDA )
115
115
self ._int1 = digitalio .DigitalInOut (board .ACCELEROMETER_INTERRUPT )
116
- try :
117
- self ._lis3dh = adafruit_lis3dh .LIS3DH_I2C (self ._i2c , address = 0x19 , int1 = self ._int1 )
118
- except TypeError :
119
- self ._lis3dh = adafruit_lis3dh .LIS3DH_I2C (self ._i2c , address = 0x19 )
116
+ self ._lis3dh = adafruit_lis3dh .LIS3DH_I2C (self ._i2c , address = 0x19 , int1 = self ._int1 )
120
117
self ._lis3dh .range = adafruit_lis3dh .RANGE_8_G
121
118
122
119
# Initialise tap:
@@ -145,13 +142,10 @@ def detect_taps(self):
145
142
@detect_taps .setter
146
143
def detect_taps (self , value ):
147
144
self ._detect_taps = value
148
- try :
149
- if value == 1 :
150
- self ._lis3dh .set_tap (value , 90 , time_limit = 4 , time_latency = 50 , time_window = 255 )
151
- if value == 2 :
152
- self ._lis3dh .set_tap (value , 60 , time_limit = 10 , time_latency = 50 , time_window = 255 )
153
- except AttributeError :
154
- pass
145
+ if value == 1 :
146
+ self ._lis3dh .set_tap (value , 90 , time_limit = 4 , time_latency = 50 , time_window = 255 )
147
+ if value == 2 :
148
+ self ._lis3dh .set_tap (value , 60 , time_limit = 10 , time_latency = 50 , time_window = 255 )
155
149
156
150
@property
157
151
def tapped (self ):
@@ -202,11 +196,7 @@ def tapped(self):
202
196
print("Done.")
203
197
204
198
"""
205
- try :
206
- return self ._lis3dh .tapped
207
- except AttributeError :
208
- raise RuntimeError ("Oops! You need a newer version of CircuitPython "
209
- "(2.2.0 or greater) to use this feature." )
199
+ return self ._lis3dh .tapped
210
200
211
201
@property
212
202
def acceleration (self ):
@@ -258,11 +248,7 @@ def shake(self, shake_threshold=30):
258
248
if cpx.shake(shake_threshold=20):
259
249
print("Shake detected more easily than before!")
260
250
"""
261
- try :
262
- return self ._lis3dh .shake (shake_threshold = shake_threshold )
263
- except AttributeError :
264
- raise RuntimeError ("Oops! You need a newer version of CircuitPython "
265
- "(2.2.0 or greater) to use this feature." )
251
+ return self ._lis3dh .shake (shake_threshold = shake_threshold )
266
252
267
253
def _touch (self , i ):
268
254
if not isinstance (self ._touches [i ], touchio .TouchIn ):
0 commit comments