/ adafruit_lsm6ds / lsm6dso32.py
lsm6dso32.py
 1  # SPDX-FileCopyrightText: Copyright (c) 2020 Bryan Siepert for Adafruit Industries
 2  #
 3  # SPDX-License-Identifier: MIT
 4  """
 5  This module provides the LSM6DSO32 subclass of LSM6DS for using LSM6DSO32 sensors.
 6  """
 7  from . import LSM6DS, LSM6DS_CHIP_ID, LSM6DS_DEFAULT_ADDRESS, AccelRange
 8  
 9  
10  class LSM6DSO32(LSM6DS):  # pylint: disable=too-many-instance-attributes
11  
12      """Driver for the LSM6DSO32 6-axis accelerometer and gyroscope.
13  
14          :param ~busio.I2C i2c_bus: The I2C bus the LSM6DSO32 is connected to.
15          :param address: The I2C slave address of the sensor
16  
17      """
18  
19      CHIP_ID = LSM6DS_CHIP_ID
20  
21      def __init__(self, i2c_bus, address=LSM6DS_DEFAULT_ADDRESS):
22          super().__init__(i2c_bus, address)
23          self._i3c_disable = True
24          self.accelerometer_range = AccelRange.RANGE_8G  # pylint:disable=no-member
25  
26      def _add_accel_ranges(self):
27          AccelRange.add_values(
28              (
29                  ("RANGE_4G", 0, 4, 0.122),
30                  ("RANGE_32G", 1, 32, 0.976),
31                  ("RANGE_8G", 2, 8, 0.244),
32                  ("RANGE_16G", 3, 16, 0.488),
33              )
34          )