/// <summary>
		/// Initializes a new instance of the
		/// <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MCPTerminalConfiguration"/>
		/// class with the channel and flags to indicated whether the channel is enabled or disabled
		/// as well as flags to indicate whether or not each pin is enabled or disabled.
		/// </summary>
		/// <param name="chan">
		/// The channel this terminal configuration represents.
		/// </param>
		/// <param name="chanEnabled">
		/// Set true to enable the channel.
		/// </param>
		/// <param name="pinAEnabled">
		/// Set true to enable pin A.
		/// </param>
		/// <param name="pinWEnabled">
		/// Set true to enable pin W.
		/// </param>
		/// <param name="pinBEnabled">
		/// Set true to enable pin B.
		/// </param>
		public MCPTerminalConfiguration(MicrochipPotChannel chan, Boolean chanEnabled, Boolean pinAEnabled, Boolean pinWEnabled, Boolean pinBEnabled) {
			this._channel = chan;
			this._channelEnabled = chanEnabled;
			this._pinAEnabled = pinAEnabled;
			this._pinWEnabled = pinWEnabled;
			this._pinBEnabled = pinBEnabled;
		}
Esempio n. 2
0
 /// <summary>
 /// Initializes a new instance of the
 /// <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MicrochipPotDeviceStatus"/>
 /// class with the wiper-lock channel and flags to indicate if currently
 /// writing to the EEPROM, whether or not the EEPROM is write-protected,
 /// and whether or not the wiper is locked.
 /// </summary>
 /// <param name="chan">
 /// The wiper-lock channel.
 /// </param>
 /// <param name="writeActive">
 /// Set true if currently writing the EEPROM.
 /// </param>
 /// <param name="writeProtected">
 /// Set true if the EEPROM is write-protected.
 /// </param>
 /// <param name="wiperLocked">
 /// Set true if the wiper is locked.
 /// </param>
 public MicrochipPotDeviceStatus(MicrochipPotChannel chan, Boolean writeActive, Boolean writeProtected, Boolean wiperLocked)
 {
     this._wiperLockChannel     = chan;
     this._eepromWriteActive    = writeActive;
     this._eepromWriteProtected = writeProtected;
     this._wiperLockActive      = wiperLocked;
 }
 /// <summary>
 /// Initializes a new instance of the
 /// <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MCPTerminalConfiguration"/>
 /// class with the channel and flags to indicated whether the channel is enabled or disabled
 /// as well as flags to indicate whether or not each pin is enabled or disabled.
 /// </summary>
 /// <param name="chan">
 /// The channel this terminal configuration represents.
 /// </param>
 /// <param name="chanEnabled">
 /// Set true to enable the channel.
 /// </param>
 /// <param name="pinAEnabled">
 /// Set true to enable pin A.
 /// </param>
 /// <param name="pinWEnabled">
 /// Set true to enable pin W.
 /// </param>
 /// <param name="pinBEnabled">
 /// Set true to enable pin B.
 /// </param>
 public MCPTerminalConfiguration(MicrochipPotChannel chan, Boolean chanEnabled, Boolean pinAEnabled, Boolean pinWEnabled, Boolean pinBEnabled)
 {
     this._channel        = chan;
     this._channelEnabled = chanEnabled;
     this._pinAEnabled    = pinAEnabled;
     this._pinWEnabled    = pinWEnabled;
     this._pinBEnabled    = pinBEnabled;
 }
        /// <summary>
        /// Determines whether or not the specified channel is supported by
        /// the underlying device.
        /// </summary>
        /// <param name="channel">
        /// The channel to check.
        /// </param>
        /// <returns>
        /// <c>true</c> if this instance is channel supported the specified channel; otherwise, <c>false</c>.
        /// </returns>
        public Boolean IsChannelSupported(MicrochipPotChannel channel)
        {
            Boolean supported = false;

            foreach (MicrochipPotChannel chan in this.SupportedChannels)
            {
                if (channel == chan)
                {
                    supported = true;
                    break;
                }
            }
            return(supported);
        }
Esempio n. 5
0
 /// <summary>
 /// Initializes a new instance of the
 /// <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.DeviceControlChannel"/>
 /// class with the volatile memory address, non-volatile memory address,
 /// terminal control address, hardware-config control bit, terminal A
 /// connection control bit, terminal B connection control bit, wiper
 /// connection control bit, and MCP potentiometer channel.
 /// </summary>
 /// <param name="volatileMemAddr">
 /// The volatile memory address.
 /// </param>
 /// <param name="nonVolatileMemAddr">
 /// The non-volatile memory address.
 /// </param>
 /// <param name="termConAddr">
 /// The terminal control address.
 /// </param>
 /// <param name="hwConfigCtrlBit">
 /// The hardware config control bit.
 /// </param>
 /// <param name="termAConnCtrlBit">
 /// The terminal A connection control bit.
 /// </param>
 /// <param name="termBConnCtrlBit">
 /// The terminal B connection control bit.
 /// </param>
 /// <param name="wiperConnCtrlBit">
 /// The wiper connection control bit.
 /// </param>
 /// <param name="chan">
 /// The MCP potentiometer channel.
 /// </param>
 protected DeviceControlChannel(Byte volatileMemAddr, Byte nonVolatileMemAddr,
                                Byte termConAddr, Int32 hwConfigCtrlBit,
                                Int32 termAConnCtrlBit, Int32 termBConnCtrlBit,
                                Int32 wiperConnCtrlBit, MicrochipPotChannel chan)
 {
     this._volatileMemAddr    = volatileMemAddr;
     this._nonVolatileMemAddr = nonVolatileMemAddr;
     this._termConAddr        = termConAddr;
     this._hwConfigCtrlBit    = hwConfigCtrlBit;
     this._termAConnCtrlBit   = termAConnCtrlBit;
     this._termBConnCtrlBit   = termBConnCtrlBit;
     this._wiperConnCtrlBit   = wiperConnCtrlBit;
     this._chan = chan;
 }
        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        /// <filterpriority>2</filterpriority>
        /// <remarks>
        /// Call <see cref="Dispose"/> when you are finished using the
        /// <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MicrochipPotentiometerBase"/>. The
        /// <see cref="Dispose"/> method leaves the
        /// <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MicrochipPotentiometerBase"/> in an unusable
        /// state. After calling <see cref="Dispose"/>, you must release all references to the
        /// <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MicrochipPotentiometerBase"/> so the garbage
        /// collector can reclaim the memory that the
        /// <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MicrochipPotentiometerBase"/> was occupying.
        /// </remarks>
        public override void Dispose()
        {
            if (base.IsDisposed)
            {
                return;
            }

            if (this._controller != null)
            {
                this._controller.Dispose();
                this._controller = null;
            }

            this._currentValue = -1;
            this._channel      = MicrochipPotChannel.None;
            this._nonVolMode   = MicrochipPotNonVolatileMode.VolatileAndNonVolatile;
            base.Dispose();
        }
Esempio n. 7
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>
        /// Initializes a new instance of the
        /// <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MicrochipPotentiometerBase"/>
        /// class with the I2C device connection, pin A0,A1, and A2 states,
        /// the potentiometer (channel) provided by the device, how to do
        /// non-volatile I/O and the initial value for devices which are not
        /// capable of non-volatile wipers.
        /// </summary>
        /// <param name="device">
        /// The I2C bus device this instance is connected to.
        /// </param>
        /// <param name="pinA0">
        /// Whether the device's address pin A0 is high (true) or low (false).
        /// </param>
        /// <param name="pinA1">
        /// Whether the device's address pin A1 is high (true) or low (false).
        /// </param>
        /// <param name="pinA2">
        /// Whether the device's address pin A2 is high (true) or low (false).
        /// </param>
        /// <param name="channel">
        /// Which of the potentiometers provided by the device to control.
        /// </param>
        /// <param name="nonVolatileMode">
        /// The way non-volatile reads or writes are done.
        /// </param>
        /// <param name="initialNonVolWiperValue">
        /// The value for devices which are not capable of non-volatile wipers.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="device"/> cannot be null. - or - <paramref name="channel"/>
        /// cannot be null.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// <paramref name="channel"/> is not supported by this device.
        /// </exception>
        /// <exception cref="System.IO.IOException">
        /// Unable to open the I2C bus.
        /// </exception>
        protected MicrochipPotentiometerBase(II2CBus device, Boolean pinA0, Boolean pinA1, Boolean pinA2,
                                             MicrochipPotChannel channel, MicrochipPotNonVolatileMode nonVolatileMode, Int32 initialNonVolWiperValue)
            : base()
        {
            if (device == null)
            {
                throw new ArgumentNullException("device");
            }

            if (!this.IsChannelSupported(channel))
            {
                throw new ArgumentException("Specified channel not supported by device.", "channel");
            }

            this._channel    = channel;
            this._nonVolMode = nonVolatileMode;
            Int32 deviceAddr = BuildI2CAddress(pinA0, pinA1, pinA2);

            this._controller       = new MicrochipPotDeviceController(device, deviceAddr);
            this.WiperActionEvent += this.MicrochipPotentiometerBase_WiperActionEvent;
            this.Initialize(initialNonVolWiperValue);
        }
Esempio n. 9
0
 /// <summary>
 /// Initializes a new instance of the
 /// <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MCP4651"/>
 /// class with the I2C device connection, pin A0, A1, and A2 states,
 /// the potentiometer (channel) provided by the device, and the
 /// initial value for devices which are not capable of non-volatile wipers.
 /// </summary>
 /// <param name="device">
 /// The I2C bus device this instance is connected to.
 /// </param>
 /// <param name="pinA0">
 /// Whether the device's address pin A0 is high (true) or low (false).
 /// </param>
 /// <param name="pinA1">
 /// Whether the device's address pin A1 is high (true) or low (false).
 /// </param>
 /// <param name="pinA2">
 /// Whether the device's address pin A2 is high (true) or low (false).
 /// </param>
 /// <param name="channel">
 /// Which of the potentiometers provided by the device to control.
 /// </param>
 /// <param name="initialValue">
 /// The value for devices which are not capable of non-volatile wipers.
 /// </param>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="device"/> cannot be null. - or - <paramref name="channel"/>
 /// cannot be null.
 /// </exception>
 /// <exception cref="ArgumentException">
 /// <paramref name="channel"/> is not supported by this device.
 /// </exception>
 /// <exception cref="System.IO.IOException">
 /// Unable to open the I2C bus.
 /// </exception>
 public MCP4651(II2CBus device, Boolean pinA0, Boolean pinA1, Boolean pinA2,
                MicrochipPotChannel channel, Int32 initialValue)
     : base(device, pinA0, pinA1, pinA2, channel, MicrochipPotNonVolatileMode.VolatileOnly, initialValue)
 {
 }
Esempio n. 10
0
		/// <summary>
		/// Initializes a new instance of the
		/// <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MCP4631"/>
		/// class with the I2C device connection, pin A0, A1, and A2 states,
		/// the potentiometer (channel) provided by the device, and the
		/// initial value for devices which are not capable of non-volatile wipers.
		/// </summary>
		/// <param name="device">
		/// The I2C bus device this instance is connected to.
		/// </param>
		/// <param name="pinA0">
		/// Whether the device's address pin A0 is high (true) or low (false).
		/// </param>
		/// <param name="pinA1">
		/// Whether the device's address pin A1 is high (true) or low (false).
		/// </param>
		/// <param name="pinA2">
		/// Whether the device's address pin A2 is high (true) or low (false).
		/// </param>
		/// <param name="channel">
		/// Which of the potentiometers provided by the device to control.
		/// </param>
		/// <param name="initialValue">
		/// The value for devices which are not capable of non-volatile wipers.
		/// </param>
		/// <exception cref="ArgumentNullException">
		/// <paramref name="device"/> cannot be null. - or - <paramref name="channel"/>
		/// cannot be null.
		/// </exception>
		/// <exception cref="ArgumentException">
		/// <paramref name="channel"/> is not supported by this device.
		/// </exception>
		/// <exception cref="System.IO.IOException">
		/// Unable to open the I2C bus.
		/// </exception>
		public MCP4631(II2CBus device, Boolean pinA0, Boolean pinA1, Boolean pinA2,
						MicrochipPotChannel channel, Int32 initialValue)
			: base(device, pinA0, pinA1, pinA2, channel, MicrochipPotNonVolatileMode.VolatileOnly, initialValue) {
		}
Esempio n. 11
0
 /// <summary>
 /// Initializes a new instance of the
 /// <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MCP4641"/>
 /// class with the I2C device connection, pin A0, A1, and A2 states,
 /// the potentiometer (channel) provided by the device, and how to
 /// do non-volatile I/O.
 /// </summary>
 /// <param name="device">
 /// The I2C bus device this instance is connected to.
 /// </param>
 /// <param name="pinA0">
 /// Whether the device's address pin A0 is high (true) or low (false).
 /// </param>
 /// <param name="pinA1">
 /// Whether the device's address pin A1 is high (true) or low (false).
 /// </param>
 /// <param name="pinA2">
 /// Whether the device's address pin A2 is high (true) or low (false).
 /// </param>
 /// <param name="channel">
 /// Which of the potentiometers provided by the device to control.
 /// </param>
 /// <param name="nonVolatileMode">
 /// The way non-volatile reads or writes are done.
 /// </param>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="device"/> cannot be null. - or - <paramref name="channel"/>
 /// cannot be null.
 /// </exception>
 /// <exception cref="ArgumentException">
 /// <paramref name="channel"/> is not supported by this device.
 /// </exception>
 /// <exception cref="System.IO.IOException">
 /// Unable to open the I2C bus.
 /// </exception>
 public MCP4641(II2CBus device, Boolean pinA0, Boolean pinA1, Boolean pinA2,
                MicrochipPotChannel channel, MicrochipPotNonVolatileMode nonVolatileMode)
     : base(device, pinA0, pinA1, pinA2, channel, nonVolatileMode, INITIALVALUE_LOADED_FROM_EEPROM)
 {
 }
		/// <summary>
		/// Determines whether or not the specified channel is supported by
		/// the underlying device.
		/// </summary>
		/// <param name="channel">
		/// The channel to check.
		/// </param>
		/// <returns>
		/// <c>true</c> if this instance is channel supported the specified channel; otherwise, <c>false</c>.
		/// </returns>
		public Boolean IsChannelSupported(MicrochipPotChannel channel) {
			Boolean supported = false;
			foreach (MicrochipPotChannel chan in this.SupportedChannels) {
				if (channel == chan) {
					supported = true;
					break;
				}
			}
			return supported;
		}
Esempio n. 13
0
		/// <summary>
		/// Initializes a new instance of the
		/// <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MCP4652"/>
		/// class with the I2C device connection, pin A0 and A1 states,
		/// the potentiometer (channel) provided by the device, and the
		/// initial value for devices which are not capable of non-volatile wipers.
		/// </summary>
		/// <param name="device">
		/// The I2C bus device this instance is connected to.
		/// </param>
		/// <param name="pinA0">
		/// Whether the device's address pin A0 is high (true) or low (false).
		/// </param>
		/// <param name="pinA1">
		/// Whether the device's address pin A1 is high (true) or low (false).
		/// </param>
		/// <param name="channel">
		/// Which of the potentiometers provided by the device to control.
		/// </param>
		/// <param name="initialValue">
		/// The value for devices which are not capable of non-volatile wipers.
		/// </param>
		/// <exception cref="ArgumentNullException">
		/// <paramref name="device"/> cannot be null. - or - <paramref name="channel"/>
		/// cannot be null.
		/// </exception>
		/// <exception cref="ArgumentException">
		/// <paramref name="channel"/> is not supported by this device.
		/// </exception>
		/// <exception cref="System.IO.IOException">
		/// Unable to open the I2C bus.
		/// </exception>
		public MCP4652(II2CBus device, Boolean pinA0, Boolean pinA1,
						MicrochipPotChannel channel, Int32 initialValue)
			: base(device, pinA0, pinA1, PIN_NOT_AVAILABLE, channel,
					MicrochipPotNonVolatileMode.VolatileOnly, initialValue) {
		}
		/// <summary>
		/// Initializes a new instance of the
		/// <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MicrochipPotentiometerBase"/>
		/// class with the I2C device connection, pin A0,A1, and A2 states,
		/// the potentiometer (channel) provided by the device, how to do
		/// non-volatile I/O and the initial value for devices which are not
		/// capable of non-volatile wipers.
		/// </summary>
		/// <param name="device">
		/// The I2C bus device this instance is connected to.
		/// </param>
		/// <param name="pinA0">
		/// Whether the device's address pin A0 is high (true) or low (false).
		/// </param>
		/// <param name="pinA1">
		/// Whether the device's address pin A1 is high (true) or low (false).
		/// </param>
		/// <param name="pinA2">
		/// Whether the device's address pin A2 is high (true) or low (false).
		/// </param>
		/// <param name="channel">
		/// Which of the potentiometers provided by the device to control.
		/// </param>
		/// <param name="nonVolatileMode">
		/// The way non-volatile reads or writes are done.
		/// </param>
		/// <param name="initialNonVolWiperValue">
		/// The value for devices which are not capable of non-volatile wipers.
		/// </param>
		/// <exception cref="ArgumentNullException">
		/// <paramref name="device"/> cannot be null. - or - <paramref name="channel"/>
		/// cannot be null.
		/// </exception>
		/// <exception cref="ArgumentException">
		/// <paramref name="channel"/> is not supported by this device.
		/// </exception>
		/// <exception cref="System.IO.IOException">
		/// Unable to open the I2C bus.
		/// </exception>
		protected MicrochipPotentiometerBase(II2CBus device, Boolean pinA0, Boolean pinA1, Boolean pinA2,
			MicrochipPotChannel channel, MicrochipPotNonVolatileMode nonVolatileMode, Int32 initialNonVolWiperValue)
			: base() {
			if (device == null) {
				throw new ArgumentNullException("device");
			}
				
			if (!this.IsChannelSupported(channel)) {
				throw new ArgumentException("Specified channel not supported by device.", "channel");
			}
				
			this._channel = channel;
			this._nonVolMode = nonVolatileMode;
			Int32 deviceAddr = BuildI2CAddress(pinA0, pinA1, pinA2);
			this._controller = new MicrochipPotDeviceController(device, deviceAddr);
			this.WiperActionEvent += this.MicrochipPotentiometerBase_WiperActionEvent;
			this.Initialize(initialNonVolWiperValue);
		}
		/// <summary>
		/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
		/// </summary>
		/// <filterpriority>2</filterpriority>
		/// <remarks>
		/// Call <see cref="Dispose"/> when you are finished using the
		/// <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MicrochipPotentiometerBase"/>. The
		/// <see cref="Dispose"/> method leaves the
		/// <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MicrochipPotentiometerBase"/> in an unusable
		/// state. After calling <see cref="Dispose"/>, you must release all references to the
		/// <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MicrochipPotentiometerBase"/> so the garbage
		/// collector can reclaim the memory that the
		/// <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MicrochipPotentiometerBase"/> was occupying.
		/// </remarks>
		public override void Dispose() {
			if (base.IsDisposed) {
				return;
			}

			if (this._controller != null) {
				this._controller.Dispose();
				this._controller = null;
			}

			this._currentValue = -1;
			this._channel = MicrochipPotChannel.None;
			this._nonVolMode = MicrochipPotNonVolatileMode.VolatileAndNonVolatile;
			base.Dispose();
		}
Esempio n. 16
0
		/// <summary>
		/// Initializes a new instance of the
		/// <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.DeviceControlChannel"/>
		/// class with the volatile memory address, non-volatile memory address,
		/// terminal control address, hardware-config control bit, terminal A
		/// connection control bit, terminal B connection control bit, wiper
		/// connection control bit, and MCP potentiometer channel.
		/// </summary>
		/// <param name="volatileMemAddr">
		/// The volatile memory address.
		/// </param>
		/// <param name="nonVolatileMemAddr">
		/// The non-volatile memory address.
		/// </param>
		/// <param name="termConAddr">
		/// The terminal control address.
		/// </param>
		/// <param name="hwConfigCtrlBit">
		/// The hardware config control bit.
		/// </param>
		/// <param name="termAConnCtrlBit">
		/// The terminal A connection control bit.
		/// </param>
		/// <param name="termBConnCtrlBit">
		/// The terminal B connection control bit.
		/// </param>
		/// <param name="wiperConnCtrlBit">
		/// The wiper connection control bit.
		/// </param>
		/// <param name="chan">
		/// The MCP potentiometer channel.
		/// </param>
		protected DeviceControlChannel(Byte volatileMemAddr, Byte nonVolatileMemAddr,
										Byte termConAddr, Int32 hwConfigCtrlBit,
										Int32 termAConnCtrlBit, Int32 termBConnCtrlBit,
										Int32 wiperConnCtrlBit, MicrochipPotChannel chan) {
			this._volatileMemAddr = volatileMemAddr;
			this._nonVolatileMemAddr = nonVolatileMemAddr;
			this._termConAddr = termConAddr;
			this._hwConfigCtrlBit = hwConfigCtrlBit;
			this._termAConnCtrlBit = termAConnCtrlBit;
			this._termBConnCtrlBit = termBConnCtrlBit;
			this._wiperConnCtrlBit = wiperConnCtrlBit;
			this._chan = chan;
		}
Esempio n. 17
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>
		/// Initializes a new instance of the
		/// <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MicrochipPotDeviceStatus"/>
		/// class with the wiper-lock channel and flags to indicate if currently
		/// writing to the EEPROM, whether or not the EEPROM is write-protected,
		/// and whether or not the wiper is locked.
		/// </summary>
		/// <param name="chan">
		/// The wiper-lock channel.
		/// </param>
		/// <param name="writeActive">
		/// Set true if currently writing the EEPROM.
		/// </param>
		/// <param name="writeProtected">
		/// Set true if the EEPROM is write-protected.
		/// </param>
		/// <param name="wiperLocked">
		/// Set true if the wiper is locked.
		/// </param>
		public MicrochipPotDeviceStatus(MicrochipPotChannel chan, Boolean writeActive, Boolean writeProtected, Boolean wiperLocked) {
			this._wiperLockChannel = chan;
			this._eepromWriteActive = writeActive;
			this._eepromWriteProtected = writeProtected;
			this._wiperLockActive = wiperLocked;
		}
Esempio n. 19
0
 /// <summary>
 /// Initializes a new instance of the
 /// <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MCP4662"/>
 /// class with the I2C device connection, pin A0 and A1 states,
 /// the potentiometer (channel) provided by the device, and how to
 /// do non-volatile I/O.
 /// </summary>
 /// <param name="device">
 /// The I2C bus device this instance is connected to.
 /// </param>
 /// <param name="pinA0">
 /// Whether the device's address pin A0 is high (true) or low (false).
 /// </param>
 /// <param name="pinA1">
 /// Whether the device's address pin A1 is high (true) or low (false).
 /// </param>
 /// <param name="channel">
 /// Which of the potentiometers provided by the device to control.
 /// </param>
 /// <param name="nonVolatileMode">
 /// The way non-volatile reads or writes are done.
 /// </param>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="device"/> cannot be null. - or - <paramref name="channel"/>
 /// cannot be null.
 /// </exception>
 /// <exception cref="ArgumentException">
 /// <paramref name="channel"/> is not supported by this device.
 /// </exception>
 /// <exception cref="System.IO.IOException">
 /// Unable to open the I2C bus.
 /// </exception>
 public MCP4662(II2CBus device, Boolean pinA0, Boolean pinA1, MicrochipPotChannel channel,
                MicrochipPotNonVolatileMode nonVolatileMode)
     : base(device, pinA0, pinA1, PIN_NOT_AVAILABLE, channel,
            nonVolatileMode, INITIALVALUE_LOADED_FROM_EEPROM)
 {
 }
Esempio n. 20
0
		/// <summary>
		/// Initializes a new instance of the
		/// <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MCP4642"/>
		/// class with the I2C device connection, pin A0 and A1 states,
		/// the potentiometer (channel) provided by the device, and how to
		/// do non-volatile I/O.
		/// </summary>
		/// <param name="device">
		/// The I2C bus device this instance is connected to.
		/// </param>
		/// <param name="pinA0">
		/// Whether the device's address pin A0 is high (true) or low (false).
		/// </param>
		/// <param name="pinA1">
		/// Whether the device's address pin A1 is high (true) or low (false).
		/// </param>
		/// <param name="channel">
		/// Which of the potentiometers provided by the device to control.
		/// </param>
		/// <param name="nonVolatileMode">
		/// The way non-volatile reads or writes are done.
		/// </param>
		/// <exception cref="ArgumentNullException">
		/// <paramref name="device"/> cannot be null. - or - <paramref name="channel"/>
		/// cannot be null.
		/// </exception>
		/// <exception cref="ArgumentException">
		/// <paramref name="channel"/> is not supported by this device.
		/// </exception>
		/// <exception cref="System.IO.IOException">
		/// Unable to open the I2C bus.
		/// </exception>
		public MCP4642(II2CBus device, Boolean pinA0, Boolean pinA1, MicrochipPotChannel channel,
						MicrochipPotNonVolatileMode nonVolatileMode)
			: base(device, pinA0, pinA1, PIN_NOT_AVAILABLE, channel,
					nonVolatileMode, INITIALVALUE_LOADED_FROM_EEPROM) {
		}
Esempio n. 21
0
		/// <summary>
		/// Initializes a new instance of the
		/// <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MCP4661"/>
		/// class with the I2C device connection, pin A0, A1, and A2 states,
		/// the potentiometer (channel) provided by the device, and how to
		/// do non-volatile I/O.
		/// </summary>
		/// <param name="device">
		/// The I2C bus device this instance is connected to.
		/// </param>
		/// <param name="pinA0">
		/// Whether the device's address pin A0 is high (true) or low (false).
		/// </param>
		/// <param name="pinA1">
		/// Whether the device's address pin A1 is high (true) or low (false).
		/// </param>
		/// <param name="pinA2">
		/// Whether the device's address pin A2 is high (true) or low (false).
		/// </param>
		/// <param name="channel">
		/// Which of the potentiometers provided by the device to control.
		/// </param>
		/// <param name="nonVolatileMode">
		/// The way non-volatile reads or writes are done.
		/// </param>
		/// <exception cref="ArgumentNullException">
		/// <paramref name="device"/> cannot be null. - or - <paramref name="channel"/>
		/// cannot be null.
		/// </exception>
		/// <exception cref="ArgumentException">
		/// <paramref name="channel"/> is not supported by this device.
		/// </exception>
		/// <exception cref="System.IO.IOException">
		/// Unable to open the I2C bus.
		/// </exception>
		public MCP4661(II2CBus device, Boolean pinA0, Boolean pinA1, Boolean pinA2,
						MicrochipPotChannel channel, MicrochipPotNonVolatileMode nonVolatileMode)
			: base(device, pinA0, pinA1, pinA2, channel, nonVolatileMode, INITIALVALUE_LOADED_FROM_EEPROM) {
		}
Esempio n. 22
0
 /// <summary>
 /// Initializes a new instance of the
 /// <see cref="CyrusBuilt.MonoPi.Components.Potentiometers.Microchip.MCP4632"/>
 /// class with the I2C device connection, pin A0 and A1 states,
 /// the potentiometer (channel) provided by the device, and the
 /// initial value for devices which are not capable of non-volatile wipers.
 /// </summary>
 /// <param name="device">
 /// The I2C bus device this instance is connected to.
 /// </param>
 /// <param name="pinA0">
 /// Whether the device's address pin A0 is high (true) or low (false).
 /// </param>
 /// <param name="pinA1">
 /// Whether the device's address pin A1 is high (true) or low (false).
 /// </param>
 /// <param name="channel">
 /// Which of the potentiometers provided by the device to control.
 /// </param>
 /// <param name="initialValue">
 /// The value for devices which are not capable of non-volatile wipers.
 /// </param>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="device"/> cannot be null. - or - <paramref name="channel"/>
 /// cannot be null.
 /// </exception>
 /// <exception cref="ArgumentException">
 /// <paramref name="channel"/> is not supported by this device.
 /// </exception>
 /// <exception cref="System.IO.IOException">
 /// Unable to open the I2C bus.
 /// </exception>
 public MCP4632(II2CBus device, Boolean pinA0, Boolean pinA1,
                MicrochipPotChannel channel, Int32 initialValue)
     : base(device, pinA0, pinA1, PIN_NOT_AVAILABLE, channel,
            MicrochipPotNonVolatileMode.VolatileOnly, initialValue)
 {
 }