/// <summary> /// Initializes a new instance of the <see cref="CyrusBuilt.MonoPi.Components.Temperature.TemperatureSensorBase"/> /// class with the clock, data, and reset pins needed for the sensor. /// </summary> /// <param name="clock"> /// The GPIO pin used for the clock. /// </param> /// <param name="data"> /// The GPIO pin used for data. /// </param> /// <param name="reset"> /// The GPIO pin used to trigger reset. /// </param> /// <exception cref="ArgumentNullException"> /// Pins cannot be null. /// </exception> protected TemperatureSensorBase(IGpio clock, IGpio data, IGpio reset) : base() { if (clock == null) { throw new ArgumentNullException("clock"); } if (data == null) { throw new ArgumentNullException("data"); } if (reset == null) { throw new ArgumentNullException("reset"); } this._tempSensor = new DS1620(clock, data, reset); }
/// <summary> /// Releaseses all resources used this object. /// </summary> /// <param name="disposing"> /// Set true if disposing managed resources in addition to unmanaged. /// </param> protected virtual void Dispose(Boolean disposing) { if (base.IsDisposed) { return; } if (disposing) { if (this._tempSensor != null) { this._tempSensor.Dispose(); this._tempSensor = null; } } this.TemperatureChanged = null; base.Dispose(true); }