This class represents the wiper. It is used for devices knowing more than one wiper.
Beispiel #1
0
        /// <summary>
        /// Sets the device's terminal configuration.
        /// </summary>
        /// <param name="config">
        /// The configuration to set.
        /// </param>
        /// <exception cref="ObjectDisposedException">
        /// This instance has been disposed and can no longer be used.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="config"/> cannot be null.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// The specified configuration cannot have a null channel.
        /// </exception>
        /// <exception cref="IOException">
        /// An I/O error occurred. The specified address is inacessible or the
        /// I2C transaction failed.
        /// </exception>
        public void SetTerminalConfiguration(DeviceControllerTerminalConfiguration config)
        {
            if (this._isDisposed)
            {
                throw new ObjectDisposedException("CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MicrochipPotDeviceController");
            }

            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            DeviceControlChannel chan = config.Channel;

            if (chan == null)
            {
                throw new ArgumentException("A configuration with a null channel is not permitted.", "config");
            }

            // Read current configuration.
            Byte  memAddr = config.Channel.TerminalControlAddress;
            Int32 tcon    = this.Read(memAddr);

            // Modify configuration.
            tcon = this.SetBit(tcon, chan.HardwareConfigControlBit, config.ChannelEnabled);
            tcon = this.SetBit(tcon, chan.TerminalAConnectionControlBit, config.PinAEnabled);
            tcon = this.SetBit(tcon, chan.WiperConnectionControlBit, config.PinWEnabled);
            tcon = this.SetBit(tcon, chan.TerminalBConnectionControlBit, config.PinBEnabled);

            // Write new config to device.
            this.Write(memAddr, tcon);
        }
Beispiel #2
0
        /// <summary>
        /// Sets the wiper's value in the device.
        /// </summary>
        /// <param name="channel">
        /// The device channel the wiper is on.
        /// </param>
        /// <param name="value">
        /// The wiper's value.
        /// </param>
        /// <param name="nonVolatile">
        /// Set true to write to non-volatile memory, or false to write to volatile memory.
        /// </param>
        /// <exception cref="ObjectDisposedException">
        /// This instance has been disposed and can no longer be used.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="channel"/> cannot be null.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// <paramref name="value"/> cannot be a negative.
        /// </exception>
        /// <exception cref="IOException">
        /// An I/O error occurred. The specified address is inacessible or the
        /// I2C transaction failed.
        /// </exception>
        public void SetValue(DeviceControlChannel channel, Int32 value, Boolean nonVolatile)
        {
            if (this._isDisposed)
            {
                throw new ObjectDisposedException("CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MicrochipPotDeviceController");
            }

            if (channel == null)
            {
                throw new ArgumentNullException("channel");
            }

            if (value < 0)
            {
                throw new ArgumentException("Only positive values are permitted. Got value '" +
                                            value.ToString() + "' for writing to channel '" +
                                            channel.Name + "'.");
            }

            // Choose proper mem address.
            Byte memAddr = nonVolatile ? channel.NonVolatileMemoryAddress : channel.VolatileMemoryAddress;

            // Write value to device.
            this.Write(memAddr, value);
        }
 /// <summary>
 /// Gets the non-volatile wiper's value.
 /// </summary>
 /// <returns>
 /// The non-volatile wiper's value.
 /// </returns>
 /// <remarks>
 /// The visibility of this method is protected because not all
 /// devices support non-volatile wipers. Any derived class may
 /// publish this method.
 /// </remarks>
 /// <exception cref="System.IO.IOException">
 /// Communication with device failed or malformed result.
 /// </exception>
 /// <exception cref="InvalidOperationException">
 /// The device is not capable of non-volatile wipers.
 /// </exception>
 protected Int32 GetNonVolatileValue()
 {
     if (!this.IsNonVolatileWiperCapable)
     {
         throw new InvalidOperationException("This device is not capable of non-volatile wipers!");
     }
     return(this._controller.GetValue(DeviceControlChannel.ValueOf(this._channel), true));
 }
		/// <summary>
		/// Initializes a new instance of the
		/// <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.DeviceControllerTerminalConfiguration"/>
		/// class with the device control channel, whether or not the
		/// channel is enabled, whether or not pin A is enabled,
		/// whether or not pin W is enabled, and whether or pin
		/// B is enabled.
		/// </summary>
		/// <param name="dcc">
		/// The device control channel.
		/// </param>
		/// <param name="chanEnabled">
		/// Set <c>true</c> to enable the channel.
		/// </param>
		/// <param name="pinAEnabled">
		/// Set <c>true</c> to enable pin A.
		/// </param>
		/// <param name="pinWEnabled">
		/// Set <c>true</c> to enable pin W.
		/// </param>
		/// <param name="pinBEnabled">
		/// Set <c>true</c> to enable pin B.
		/// </param>
		public DeviceControllerTerminalConfiguration(DeviceControlChannel dcc,
													Boolean chanEnabled,
													Boolean pinAEnabled,
													Boolean pinWEnabled,
													Boolean pinBEnabled) {
			this._channel = dcc;
			this._channelEnabled = chanEnabled;
			this._pinAEnabled = pinAEnabled;
			this._pinWEnabled = pinWEnabled;
			this._pinBEnabled = pinBEnabled;
		}
 /// <summary>
 /// Initializes a new instance of the
 /// <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.DeviceControllerTerminalConfiguration"/>
 /// class with the device control channel, whether or not the
 /// channel is enabled, whether or not pin A is enabled,
 /// whether or not pin W is enabled, and whether or pin
 /// B is enabled.
 /// </summary>
 /// <param name="dcc">
 /// The device control channel.
 /// </param>
 /// <param name="chanEnabled">
 /// Set <c>true</c> to enable the channel.
 /// </param>
 /// <param name="pinAEnabled">
 /// Set <c>true</c> to enable pin A.
 /// </param>
 /// <param name="pinWEnabled">
 /// Set <c>true</c> to enable pin W.
 /// </param>
 /// <param name="pinBEnabled">
 /// Set <c>true</c> to enable pin B.
 /// </param>
 public DeviceControllerTerminalConfiguration(DeviceControlChannel dcc,
                                              Boolean chanEnabled,
                                              Boolean pinAEnabled,
                                              Boolean pinWEnabled,
                                              Boolean pinBEnabled)
 {
     this._channel        = dcc;
     this._channelEnabled = chanEnabled;
     this._pinAEnabled    = pinAEnabled;
     this._pinWEnabled    = pinWEnabled;
     this._pinBEnabled    = pinBEnabled;
 }
Beispiel #6
0
        /// <summary>
        /// Determines whether the specified
        /// <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.DeviceControlChannel"/>
        /// is equal to the current <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.DeviceControlChannel"/>.
        /// </summary>
        /// <param name="dcc">
        /// The <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.DeviceControlChannel"/>
        /// to compare with the current <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.DeviceControlChannel"/>.
        /// </param>
        /// <returns>
        /// <c>true</c> if the specified
        /// <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.DeviceControlChannel"/>
        /// is equal to the current
        /// <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.DeviceControlChannel"/>;
        /// otherwise, <c>false</c>.
        /// </returns>
        public Boolean Equals(DeviceControlChannel dcc)
        {
            if (dcc == null)
            {
                return(false);
            }

            return((this._chan == dcc.Channel) && (this._hwConfigCtrlBit == dcc.HardwareConfigControlBit) &&
                   (this._nonVolatileMemAddr == dcc.NonVolatileMemoryAddress) &&
                   (this._termAConnCtrlBit == dcc.TerminalAConnectionControlBit) &&
                   (this._termBConnCtrlBit == dcc.TerminalBConnectionControlBit) &&
                   (this._termConAddr == dcc.TerminalControlAddress) &&
                   (this._volatileMemAddr == dcc.VolatileMemoryAddress) &&
                   (this._wiperConnCtrlBit == dcc.WiperConnectionControlBit));
        }
Beispiel #7
0
        /// <summary>
        /// Receives the current wiper's value from the device.
        /// </summary>
        /// <param name="channel">
        /// The device channel the wiper is on.
        /// </param>
        /// <param name="nonVolatile">
        /// Set true to read from non-volatile memory, false to read from
        /// volatile memory.
        /// </param>
        /// <returns>
        /// The wiper's value.
        /// </returns>
        /// <exception cref="ObjectDisposedException">
        /// This instance has been disposed and can no longer be used.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="channel"/> cannot be null.
        /// </exception>
        /// <exception cref="IOException">
        /// Unable to read from device.
        /// </exception>
        public Int32 GetValue(DeviceControlChannel channel, Boolean nonVolatile)
        {
            if (this._isDisposed)
            {
                throw new ObjectDisposedException("CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MicrochipPotDeviceController");
            }

            if (channel == null)
            {
                throw new ArgumentNullException("channel");
            }

            // Select proper memory address, then read the value at that address.
            Byte memAddr = nonVolatile ? channel.NonVolatileMemoryAddress : channel.VolatileMemoryAddress;

            return(this.Read(memAddr));
        }
Beispiel #8
0
        /// <summary>
        /// Increments the volatile wiper for the given number of steps.
        /// </summary>
        /// <param name="channel">
        /// The device channel the wiper is on.
        /// </param>
        /// <param name="steps">
        /// The number of steps.
        /// </param>
        /// <exception cref="ObjectDisposedException">
        /// This instance has been disposed and can no longer be used.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="channel"/> cannot be null.
        /// </exception>
        /// <exception cref="IOException">
        /// An I/O error occurred. The specified address is inacessible or the
        /// I2C transaction failed.
        /// </exception>
        public void Increase(DeviceControlChannel channel, Int32 steps)
        {
            if (this._isDisposed)
            {
                throw new ObjectDisposedException("CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MicrochipPotDeviceController");
            }

            if (channel == null)
            {
                throw new ArgumentNullException("channel");
            }

            // Decrease only works on volatile-wiper.
            Byte memAddr = channel.VolatileMemoryAddress;

            this.IncreaseOrDecrease(memAddr, true, steps);
        }
        /// <summary>
        /// Initializes the wiper to a defined status. For devices capable of non-volatile
        /// wipers, the non-volatile value is loaded. For devices not capable, the given
        /// value is set in the device.
        /// </summary>
        /// <param name="initialValForNonVolWipers">
        /// The initial value for devices not capable of non-volatile wipers.
        /// </param>
        /// <exception cref="System.IO.IOException">
        /// Communication with device failed or malformed result.
        /// </exception>
        protected void Initialize(Int32 initialValForNonVolWipers)
        {
            DeviceControlChannel ctrlchan = DeviceControlChannel.ValueOf(this._channel);

            if (this.IsNonVolatileWiperCapable)
            {
                this._currentValue = this._controller.GetValue(ctrlchan, false);
            }
            else
            {
                Int32 newInitialVolWiperVal = this.GetValueAccordingBoundaries(initialValForNonVolWipers);
                this._controller.SetValue(DeviceControlChannel.ValueOf(this._channel),
                                          newInitialVolWiperVal,
                                          MicrochipPotDeviceController.VOLATILE_WIPER);
                this._currentValue = newInitialVolWiperVal;
            }
        }
Beispiel #10
0
        /// <summary>
        /// Enables or disables the wiper's lock.
        /// </summary>
        /// <param name="channel">
        /// The channel of the wiper to set the lock for.
        /// </param>
        /// <param name="locked">
        /// Set true to enable the lock, or false to disable.
        /// </param>
        /// <exception cref="ObjectDisposedException">
        /// This instance has been disposed and can no longer be used.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="channel"/> cannot be null.
        /// </exception>
        /// <exception cref="IOException">
        /// An I/O error occurred. The specified address is inacessible or the
        /// I2C transaction failed.
        /// </exception>
        public void SetWiperLock(DeviceControlChannel channel, Boolean locked)
        {
            if (this._isDisposed)
            {
                throw new ObjectDisposedException("CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MicrochipPotDeviceController");
            }

            if (channel == null)
            {
                throw new ArgumentNullException("channel");
            }

            // Increasing or decreasing on non-volatile wipers
            // enables or disables WiperLock.
            Byte memAddr = channel.NonVolatileMemoryAddress;

            this.IncreaseOrDecrease(memAddr, locked, 1);
        }
Beispiel #11
0
        /// <summary>
        /// Factory method for creating a device control channel based on the
        /// given potentiometer channel.
        /// </summary>
        /// <param name="channel">
        /// The MCP potentiometer channel.
        /// </param>
        /// <returns>
        /// A new instance of <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.DeviceControlChannel"/>.
        /// If no potentiometer channel was specified, then returns null.
        /// </returns>
        public static DeviceControlChannel ValueOf(MicrochipPotChannel channel)
        {
            if (channel == MicrochipPotChannel.None)
            {
                return(null);
            }

            DeviceControlChannel result = null;
            String chanName             = Enum.GetName(typeof(MicrochipPotChannel), channel);

            foreach (DeviceControlChannel dc in DeviceControlChannel.ALL)
            {
                if (dc.Name.Equals(chanName))
                {
                    result = dc;
                    break;
                }
            }
            return(result);
        }
        /// <summary>
        /// Increases the wiper's value by the specified number of steps.
        /// It is not an error if the wiper hits or already hit the upper
        /// boundary. In such situations, the wiper sticks to the upper
        /// boundary or doesn't change.
        /// </summary>
        /// <param name="steps">
        /// How many steps to increase.
        /// </param>
        /// <exception cref="System.IO.IOException">
        /// Communication with the device failed.
        /// </exception>
        public void Increase(Int32 steps)
        {
            Int32 maxVal = this.MaxValue;

            if (this._currentValue == maxVal)
            {
                return;
            }

            if (steps < 0)
            {
                throw new ArgumentException("Only positive values are permitted.", "steps");
            }

            if (this.NonVolatileMode != MicrochipPotNonVolatileMode.VolatileOnly)
            {
                throw new InvalidOperationException("Increase only permitted for volatile-only wipers.");
            }

            // Check boundaries.
            Int32 actualSteps = steps;

            if ((steps + this._currentValue) > maxVal)
            {
                actualSteps = (maxVal - this._currentValue);
            }

            Int32 newVal = (this._currentValue + actualSteps);

            if ((newVal == maxVal) || (steps > 5))
            {
                this.CurrentValue = newVal;
            }
            else
            {
                this._controller.Increase(DeviceControlChannel.ValueOf(this._channel), actualSteps);
                this._currentValue = newVal;
            }
        }
Beispiel #13
0
        /// <summary>
        /// Determines whether the specified <see cref="System.Object"/> is equal to
        /// the current <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.DeviceControlChannel"/>.
        /// </summary>
        /// <param name="obj">
        /// The <see cref="System.Object"/> to compare with the current
        /// <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.DeviceControlChannel"/>.
        /// </param>
        /// <returns>
        /// <c>true</c> if the specified <see cref="System.Object"/> is equal to the current
        /// <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.DeviceControlChannel"/>;
        /// otherwise, <c>false</c>.
        /// </returns>
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            DeviceControlChannel dcc = obj as DeviceControlChannel;

            if ((Object)dcc == null)
            {
                return(false);
            }

            return((this._chan == dcc.Channel) && (this._hwConfigCtrlBit == dcc.HardwareConfigControlBit) &&
                   (this._nonVolatileMemAddr == dcc.NonVolatileMemoryAddress) &&
                   (this._termAConnCtrlBit == dcc.TerminalAConnectionControlBit) &&
                   (this._termBConnCtrlBit == dcc.TerminalBConnectionControlBit) &&
                   (this._termConAddr == dcc.TerminalControlAddress) &&
                   (this._volatileMemAddr == dcc.VolatileMemoryAddress) &&
                   (this._wiperConnCtrlBit == dcc.WiperConnectionControlBit));
        }
Beispiel #14
0
        /// <summary>
        /// Gets the terminal configuration for the specified channel.
        /// </summary>
        /// <param name="channel">
        /// The channel to get the terminal configuration for.
        /// </param>
        /// <returns>
        /// The terminal configuration.
        /// </returns>
        /// <exception cref="ObjectDisposedException">
        /// This instance has been disposed and can no longer be used.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="channel"/> cannot be null.
        /// </exception>
        /// <exception cref="IOException">
        /// Unable to read from device.
        /// </exception>
        public DeviceControllerTerminalConfiguration GetTerminalConfiguration(DeviceControlChannel channel)
        {
            if (this._isDisposed)
            {
                throw new ObjectDisposedException("CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MicrochipPotDeviceController");
            }

            if (channel == null)
            {
                throw new ArgumentNullException("channel");
            }

            // Read the current config.
            Int32 tcon = this.Read(channel.TerminalControlAddress);

            // Build result;
            Boolean chanEnabled = ((tcon & channel.HardwareConfigControlBit) > 0);
            Boolean pinAEnabled = ((tcon & channel.TerminalAConnectionControlBit) > 0);
            Boolean pinWEnabled = ((tcon & channel.WiperConnectionControlBit) > 0);
            Boolean pinBEnabled = ((tcon & channel.TerminalBConnectionControlBit) > 0);

            return(new DeviceControllerTerminalConfiguration(channel, chanEnabled, pinAEnabled, pinWEnabled, pinBEnabled));
        }
 /// <summary>
 /// Updates the cache to the wiper's value.
 /// </summary>
 /// <returns>
 /// The wiper's current value.
 /// </returns>
 /// <exception cref="System.IO.IOException">
 /// Communication with device failed or malformed result.
 /// </exception>
 public Int32 UpdateCacheFromDevice()
 {
     this._currentValue = this._controller.GetValue(DeviceControlChannel.ValueOf(this._channel), false);
     return(this._currentValue);
 }
 /// <summary>
 /// Initializes a new instance of the
 /// <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MicrochipPotentiometerBase.WiperEventArgs"/>
 /// class with the device control channel, device controller, and
 /// device reading value.
 /// </summary>
 /// <param name="channel">
 /// The control channel for the wiper.
 /// </param>
 /// <param name="controller">
 /// The device controller.
 /// </param>
 /// <param name="val">
 /// The device reading value.
 /// </param>
 public WiperEventArgs(DeviceControlChannel channel, MicrochipPotDeviceController controller, Int32 val)
     : base()
 {
     this._chan = channel;
     this._ctlr = controller;
 }
 /// <summary>
 /// Enables or disables the wiper lock.
 /// </summary>
 /// <param name="enabled">
 /// Set true to enable.
 /// </param>
 /// <exception cref="System.IO.IOException">
 /// Communication with device failed or malformed result.
 /// </exception>
 public void SetWiperLock(Boolean enabled)
 {
     this._controller.SetWiperLock(DeviceControlChannel.ValueOf(this._channel), enabled);
 }
		/// <summary>
		/// Enables or disables the wiper's lock.
		/// </summary>
		/// <param name="channel">
		/// The channel of the wiper to set the lock for.
		/// </param>
		/// <param name="locked">
		/// Set true to enable the lock, or false to disable.
		/// </param>
		/// <exception cref="ObjectDisposedException">
		/// This instance has been disposed and can no longer be used.
		/// </exception>
		/// <exception cref="ArgumentNullException">
		/// <paramref name="channel"/> cannot be null.
		/// </exception>
		/// <exception cref="IOException">
		/// An I/O error occurred. The specified address is inacessible or the
		/// I2C transaction failed.
		/// </exception>
		public void SetWiperLock(DeviceControlChannel channel, Boolean locked) {
			if (this._isDisposed) {
				throw new ObjectDisposedException("CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MicrochipPotDeviceController");
			}

			if (channel == null) {
				throw new ArgumentNullException("channel");
			}

			// Increasing or decreasing on non-volatile wipers
			// enables or disables WiperLock.
			Byte memAddr = channel.NonVolatileMemoryAddress;
			this.IncreaseOrDecrease(memAddr, locked, 1);
		}
		/// <summary>
		/// Gets the terminal configuration for the specified channel.
		/// </summary>
		/// <param name="channel">
		/// The channel to get the terminal configuration for.
		/// </param>
		/// <returns>
		/// The terminal configuration.
		/// </returns>
		/// <exception cref="ObjectDisposedException">
		/// This instance has been disposed and can no longer be used.
		/// </exception>
		/// <exception cref="ArgumentNullException">
		/// <paramref name="channel"/> cannot be null.
		/// </exception>
		/// <exception cref="IOException">
		/// Unable to read from device.
		/// </exception>
		public DeviceControllerTerminalConfiguration GetTerminalConfiguration(DeviceControlChannel channel) {
			if (this._isDisposed) {
				throw new ObjectDisposedException("CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MicrochipPotDeviceController");
			}

			if (channel == null) {
				throw new ArgumentNullException("channel");
			}

			// Read the current config.
			Int32 tcon = this.Read(channel.TerminalControlAddress);

			// Build result;
			Boolean chanEnabled = ((tcon & channel.HardwareConfigControlBit) > 0);
			Boolean pinAEnabled = ((tcon & channel.TerminalAConnectionControlBit) > 0);
			Boolean pinWEnabled = ((tcon & channel.WiperConnectionControlBit) > 0);
			Boolean pinBEnabled = ((tcon & channel.TerminalBConnectionControlBit) > 0);
			return new DeviceControllerTerminalConfiguration(channel, chanEnabled, pinAEnabled, pinWEnabled, pinBEnabled);
		}
		/// <summary>
		/// Sets the wiper's value in the device.
		/// </summary>
		/// <param name="channel">
		/// The device channel the wiper is on.
		/// </param>
		/// <param name="value">
		/// The wiper's value.
		/// </param>
		/// <param name="nonVolatile">
		/// Set true to write to non-volatile memory, or false to write to volatile memory.
		/// </param>
		/// <exception cref="ObjectDisposedException">
		/// This instance has been disposed and can no longer be used.
		/// </exception>
		/// <exception cref="ArgumentNullException">
		/// <paramref name="channel"/> cannot be null.
		/// </exception>
		/// <exception cref="ArgumentException">
		/// <paramref name="value"/> cannot be a negative.
		/// </exception>
		/// <exception cref="IOException">
		/// An I/O error occurred. The specified address is inacessible or the
		/// I2C transaction failed.
		/// </exception>
		public void SetValue(DeviceControlChannel channel, Int32 value, Boolean nonVolatile) {
			if (this._isDisposed) {
				throw new ObjectDisposedException("CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MicrochipPotDeviceController");
			}

			if (channel == null) {
				throw new ArgumentNullException("channel");
			}

			if (value < 0) {
				throw new ArgumentException("Only positive values are permitted. Got value '" +
											value.ToString() + "' for writing to channel '" +
											channel.Name + "'.");
			}

			// Choose proper mem address.
			Byte memAddr = nonVolatile ? channel.NonVolatileMemoryAddress : channel.VolatileMemoryAddress;

			// Write value to device.
			this.Write(memAddr, value);
		}
			/// <summary>
			/// Initializes a new instance of the
			/// <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MicrochipPotentiometerBase.WiperEventArgs"/>
			/// class with the device control channel, device controller, and
			/// device reading value.
			/// </summary>
			/// <param name="channel">
			/// The control channel for the wiper.
			/// </param>
			/// <param name="controller">
			/// The device controller.
			/// </param>
			/// <param name="val">
			/// The device reading value.
			/// </param>
			public WiperEventArgs(DeviceControlChannel channel, MicrochipPotDeviceController controller, Int32 val)
				: base() {
				this._chan = channel;
				this._ctlr = controller;
			}
		/// <summary>
		/// Determines whether the specified
		/// <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.DeviceControlChannel"/>
		/// is equal to the current <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.DeviceControlChannel"/>.
		/// </summary>
		/// <param name="dcc">
		/// The <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.DeviceControlChannel"/>
		/// to compare with the current <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.DeviceControlChannel"/>.
		/// </param>
		/// <returns>
		/// <c>true</c> if the specified
		/// <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.DeviceControlChannel"/>
		/// is equal to the current
		/// <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.DeviceControlChannel"/>;
		/// otherwise, <c>false</c>.
		/// </returns>
		public Boolean Equals(DeviceControlChannel dcc) {
			if (dcc == null) {
				return false;
			}

			return ((this._chan == dcc.Channel) && (this._hwConfigCtrlBit == dcc.HardwareConfigControlBit) &&
					(this._nonVolatileMemAddr == dcc.NonVolatileMemoryAddress) &&
					(this._termAConnCtrlBit == dcc.TerminalAConnectionControlBit) &&
					(this._termBConnCtrlBit == dcc.TerminalBConnectionControlBit) &&
					(this._termConAddr == dcc.TerminalControlAddress) &&
					(this._volatileMemAddr == dcc.VolatileMemoryAddress) &&
					(this._wiperConnCtrlBit == dcc.WiperConnectionControlBit));
		}
		/// <summary>
		/// Receives the current wiper's value from the device.
		/// </summary>
		/// <param name="channel">
		/// The device channel the wiper is on.
		/// </param>
		/// <param name="nonVolatile">
		/// Set true to read from non-volatile memory, false to read from
		/// volatile memory.
		/// </param>
		/// <returns>
		/// The wiper's value.
		/// </returns>
		/// <exception cref="ObjectDisposedException">
		/// This instance has been disposed and can no longer be used.
		/// </exception>
		/// <exception cref="ArgumentNullException">
		/// <paramref name="channel"/> cannot be null.
		/// </exception>
		/// <exception cref="IOException">
		/// Unable to read from device.
		/// </exception>
		public Int32 GetValue(DeviceControlChannel channel, Boolean nonVolatile) {
			if (this._isDisposed) {
				throw new ObjectDisposedException("CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MicrochipPotDeviceController");
			}

			if (channel == null) {
				throw new ArgumentNullException("channel");
			}

			// Select proper memory address, then read the value at that address.
			Byte memAddr = nonVolatile ? channel.NonVolatileMemoryAddress : channel.VolatileMemoryAddress;
			return this.Read(memAddr);
		}
		/// <summary>
		/// Increments the volatile wiper for the given number of steps.
		/// </summary>
		/// <param name="channel">
		/// The device channel the wiper is on.
		/// </param>
		/// <param name="steps">
		/// The number of steps.
		/// </param>
		/// <exception cref="ObjectDisposedException">
		/// This instance has been disposed and can no longer be used.
		/// </exception>
		/// <exception cref="ArgumentNullException">
		/// <paramref name="channel"/> cannot be null.
		/// </exception>
		/// <exception cref="IOException">
		/// An I/O error occurred. The specified address is inacessible or the
		/// I2C transaction failed.
		/// </exception>
		public void Increase(DeviceControlChannel channel, Int32 steps) {
			if (this._isDisposed) {
				throw new ObjectDisposedException("CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MicrochipPotDeviceController");
			}

			if (channel == null) {
				throw new ArgumentNullException("channel");
			}

			// Decrease only works on volatile-wiper.
			Byte memAddr = channel.VolatileMemoryAddress;
			this.IncreaseOrDecrease(memAddr, true, steps);
		}