@@ -123,16 +123,6 @@ class AccelRange(CV):
123
123
"""Options for ``accelerometer_range``"""
124
124
125
125
126
- AccelRange .add_values (
127
- (
128
- ("RANGE_2G" , 0 , 2 , 0.061 ),
129
- ("RANGE_16G" , 1 , 16 , 0.488 ),
130
- ("RANGE_4G" , 2 , 4 , 0.122 ),
131
- ("RANGE_8G" , 3 , 8 , 0.244 ),
132
- )
133
- )
134
-
135
-
136
126
class GyroRange (CV ):
137
127
"""Options for ``gyro_data_range``"""
138
128
@@ -236,6 +226,7 @@ def __init__(self, i2c_bus, address=_LSM6DS_DEFAULT_ADDRESS):
236
226
237
227
self ._bdu = True
238
228
229
+ self ._add_accel_ranges ()
239
230
self .accelerometer_data_rate = Rate .RATE_104_HZ # pylint: disable=no-member
240
231
self .gyro_data_rate = Rate .RATE_104_HZ # pylint: disable=no-member
241
232
@@ -248,10 +239,22 @@ def reset(self):
248
239
while self ._sw_reset :
249
240
sleep (0.001 )
250
241
242
+ @staticmethod
243
+ def _add_accel_ranges ():
244
+ AccelRange .add_values (
245
+ (
246
+ ("RANGE_2G" , 0 , 2 , 0.061 ),
247
+ ("RANGE_16G" , 1 , 16 , 0.488 ),
248
+ ("RANGE_4G" , 2 , 4 , 0.122 ),
249
+ ("RANGE_8G" , 3 , 8 , 0.244 ),
250
+ )
251
+ )
252
+
251
253
@property
252
254
def acceleration (self ):
253
255
"""The x, y, z acceleration values returned in a 3-tuple and are in m / s ^ 2."""
254
256
raw_accel_data = self ._raw_accel_data
257
+
255
258
x = self ._scale_xl_data (raw_accel_data [0 ])
256
259
y = self ._scale_xl_data (raw_accel_data [1 ])
257
260
z = self ._scale_xl_data (raw_accel_data [2 ])
@@ -386,6 +389,33 @@ def __init__(self, i2c_bus, address=_LSM6DS_DEFAULT_ADDRESS):
386
389
self ._i3c_disable = True
387
390
388
391
392
+ class LSM6DSO32 (LSM6DS ): # pylint: disable=too-many-instance-attributes
393
+
394
+ """Driver for the LSM6DSO32 6-axis accelerometer and gyroscope.
395
+
396
+ :param ~busio.I2C i2c_bus: The I2C bus the LSM6DSO32 is connected to.
397
+ :param address: The I2C slave address of the sensor
398
+
399
+ """
400
+
401
+ CHIP_ID = _LSM6DS_CHIP_ID
402
+
403
+ def __init__ (self , i2c_bus , address = _LSM6DS_DEFAULT_ADDRESS ):
404
+ super ().__init__ (i2c_bus , address )
405
+ self ._i3c_disable = True
406
+ self .accelerometer_range = AccelRange .RANGE_8G # pylint:disable=no-member
407
+
408
+ def _add_accel_ranges (self ):
409
+ AccelRange .add_values (
410
+ (
411
+ ("RANGE_4G" , 0 , 4 , 0.122 ),
412
+ ("RANGE_32G" , 1 , 32 , 0.976 ),
413
+ ("RANGE_8G" , 2 , 8 , 0.244 ),
414
+ ("RANGE_16G" , 3 , 16 , 0.488 ),
415
+ )
416
+ )
417
+
418
+
389
419
class LSM6DS33 (LSM6DS ): # pylint: disable=too-many-instance-attributes
390
420
391
421
"""Driver for the LSM6DS33 6-axis accelerometer and gyroscope.
0 commit comments