/// <summary> /// Configures the device. /// </summary> /// <param name="OneShot">If tepmerature conversions are made on request.</param> /// <param name="FaultQueue">Fault queue.</param> /// <param name="AlertPolarity">Alert polarity.</param> /// <param name="ThermostatMode">Thermostat mode.</param> /// <param name="ShutdownMode">Shutdown mode.</param> /// <param name="ConversionRate">Conversion rate.</param> /// <param name="ExtendedMode">Extended mode</param> public void Configure(bool OneShot, FaultQueue FaultQueue, AlertPolarity AlertPolarity, ThermostatMode ThermostatMode, bool ShutdownMode, ConversionRate ConversionRate, bool ExtendedMode) { byte H = (byte)(OneShot ? 1 : 0); H <<= 2; H |= 3; // Resolution=11 H <<= 2; H |= (byte)FaultQueue; H <<= 1; H |= (byte)AlertPolarity; H <<= 1; H |= (byte)ThermostatMode; H <<= 1; H |= (byte)(ShutdownMode ? 1 : 0); byte L = (byte)ConversionRate; L <<= 2; L |= (byte)(ExtendedMode ? 1 : 0); L <<= 4; if (!this.i2cBus.Write(this.address, 1, H, L)) { throw new System.IO.IOException("Unable to write register."); } }
/// <summary> /// Configures the device. /// </summary> /// <param name="OneShot">If tepmerature conversions are made on request.</param> /// <param name="FaultQueue">Fault queue.</param> /// <param name="AlertPolarity">Alert polarity.</param> /// <param name="ThermostatMode">Thermostat mode.</param> /// <param name="ShutdownMode">Shutdown mode.</param> /// <param name="ConversionRate">Conversion rate.</param> /// <param name="ExtendedMode">Extended mode</param> public void Configure (bool OneShot, FaultQueue FaultQueue, AlertPolarity AlertPolarity, ThermostatMode ThermostatMode, bool ShutdownMode, ConversionRate ConversionRate, bool ExtendedMode) { byte H = (byte)(OneShot ? 1 : 0); H <<= 2; H |= 3; // Resolution=11 H <<= 2; H |= (byte)FaultQueue; H <<= 1; H |= (byte)AlertPolarity; H <<= 1; H |= (byte)ThermostatMode; H <<= 1; H |= (byte)(ShutdownMode ? 1 : 0); byte L = (byte)ConversionRate; L <<= 2; L |= (byte)(ExtendedMode ? 1 : 0); L <<= 4; if (!this.i2cBus.Write (this.address, 1, H, L)) throw new System.IO.IOException ("Unable to write register."); }