def __init__(self, bus,
                 i2c_address=DEFAULT_I2C_ADDRESS,
                 osrs_t=DEFAULT_OVERSAMPLING_TEMP,
                 osrs_p=DEFAULT_OVERSAMPLING_PRES,
                 osrs_h=DEFAULT_OVERSAMPLING_HUM,
                 mode=DEFAULT_OPERATION_MODE,
                 t_sb=DEFAULT_T_STANDBY,
                 filter_mode=DEFAULT_FILTER_MODE,
                 delta_temp=DEFAULT_DELTA_TEMP,
                 spi3w_en=0,  # 3-wire SPI Disable
                 logger=None):
        """Initialize the sensor handler."""
        I2cBaseClass.__init__(self, bus, i2c_address, logger)

        # BME280 parameters
        self.mode = mode
        self.ctrl_meas_reg = (osrs_t << 5) | (osrs_p << 2) | self.mode
        self.config_reg = (t_sb << 5) | (filter_mode << 2) | spi3w_en
        self.ctrl_hum_reg = osrs_h

        self._delta_temp = delta_temp
        self._with_pressure = osrs_p > 0
        self._with_humidity = osrs_h > 0

        # Calibration data
        self._calibration_t = None
        self._calibration_h = None
        self._calibration_p = None
        self._temp_fine = None

        # Sensor data
        self._temperature = None
        self._humidity = None
        self._pressure = None

        self.update(True)
def __init__ ( self , bus , i2c_address = DEFAULT_I2C_ADDRESS , osrs_t = DEFAULT_OVERSAMPLING_TEMP , osrs_p = DEFAULT_OVERSAMPLING_PRES , osrs_h = DEFAULT_OVERSAMPLING_HUM , mode = DEFAULT_OPERATION_MODE , t_sb = DEFAULT_T_STANDBY , filter_mode = DEFAULT_FILTER_MODE , delta_temp = DEFAULT_DELTA_TEMP , spi3w_en = 0 , logger = None ) : I2cBaseClass . __init__ ( self , bus , i2c_address , logger ) self . mode = mode self . ctrl_meas_reg = ( osrs_t << 5 ) | ( osrs_p << 2 ) | self . mode self . config_reg = ( t_sb << 5 ) | ( filter_mode << 2 ) | spi3w_en self . ctrl_hum_reg = osrs_h self . _delta_temp = delta_temp self . _with_pressure = osrs_p > 0 self . _with_humidity = osrs_h > 0 self . _calibration_t = None self . _calibration_h = None self . _calibration_p = None self . _temp_fine = None self . _temperature = None self . _humidity = None self . _pressure = None self . update ( True )
Initialize the sensor handler.