def __init__(self, sensor_name, bus, addr=_DEFAULT_ADDRESS): '''Initializes the sensor with some default values. bus: The SMBus descriptor on which this sensor is attached. addr: The I2C bus address (default is 0x40). ''' SensorBase.__init__( self, sensor_name=sensor_name) self._ior = io.open('/dev/i2c-' + str(bus), 'rb', buffering=0) self._iow = io.open('/dev/i2c-' + str(bus), 'wb', buffering=0) fcntl.ioctl(self._ior, _I2C_SLAVE, addr) fcntl.ioctl(self._iow, _I2C_SLAVE, addr) self._resolution = RESOLUTION_12BITS self._onchip_heater = _DISABLE_ONCHIP_HEATER self._otp_reload = _DISABLE_OTP_RELOAD self._use_temperature = True self._reset() self._reconfigure()
def __init__(self, sensor_name): SensorBase.__init__(self, sensor_name=sensor_name)