/// <summary> /// Initializes a new instance of the <see cref="CyrusBuilt.MonoPi.Components.Sensors.MotionSensorComponent"/> /// class with the <see cref="CyrusBuilt.MonoPi.IO.GpioFile"/> I/O pin to use. /// </summary> /// <param name="pin"> /// The <see cref="CyrusBuilt.MonoPi.IO.GpioFile"/> I/O pin to use. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="pin"/> cannot null. /// </exception> public MotionSensorComponent(GpioFile pin) : base(pin) { }
/// <summary> /// Initializes a new instance of the /// <see cref="CyrusBuilt.MonoPi.Components.Temperature.TemperatureSensorComponent"/> /// class with the clock, data, and reset pins needed for the sensor, /// as well as the scale to get the temperature readings in. /// </summary> /// <param name="scale"> /// The scale to get the temperature readings in. /// </param> /// <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> public TemperatureSensorComponent(TemperatureScale scale, GpioFile clock, GpioFile data, GpioFile reset) : base(clock, data, reset) { this._scale = scale; }
/// <summary> /// Initializes a new instance of the /// <see cref="CyrusBuilt.MonoPi.Components.Temperature.TemperatureSensorComponent"/> /// 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> public TemperatureSensorComponent(GpioFile clock, GpioFile data, GpioFile reset) : base(clock, data, reset) { }
/// <summary> /// Initializes a new instance of the <see cref="CyrusBuilt.MonoPi.LCD.GpioFileLcdTransferProvider"/> /// class with the mode, register select pin, read/write pin, enable /// pin, and data lines. /// </summary> /// <param name="fourBitMode"> /// If set to true, then use 4 bit mode instead of 8 bit. /// </param> /// <param name="rs"> /// The number of the CPU pin that is connected to the RS (Register Select) /// pin on the LCD. /// </param> /// <param name="rw"> /// The number of the CPU pin that is connected to the RW (Read/Write) /// pin on the LCD. /// </param> /// <param name="enable"> /// The number of the CPU pin that is connected to the enable pin on /// the LCD. /// </param> /// <param name="d0"> /// Data line 0. /// </param> /// <param name="d1"> /// Data line 1. /// </param> /// <param name="d2"> /// Data line 2. /// </param> /// <param name="d3"> /// Data line 3. /// </param> /// <param name="d4"> /// Data line 4. /// </param> /// <param name="d5"> /// Data line 5. /// </param> /// <param name="d6"> /// Data line 6. /// </param> /// <param name="d7"> /// Data line 7. /// </param> /// <remarks> /// The display can be controlled using 4 or 8 data lines. If the former, /// omit the pin numbers for d0 to d3 and leave those lines disconnected. /// The RW pin can be tied to ground instead of connected to a pin on the /// Arduino; If so, omit it from this constructor's parameters. /// </remarks> /// <exception cref="ArgumentException"> /// <paramref name="rs"/> and <paramref name="enable"/> cannot be set to /// <see cref="GpioPins.GPIO_NONE"/>. /// </exception> public GpioFileLcdTransferProvider(Boolean fourBitMode, GpioPins rs, GpioPins rw, GpioPins enable, GpioPins d0, GpioPins d1, GpioPins d2, GpioPins d3, GpioPins d4, GpioPins d5, GpioPins d6, GpioPins d7) { this._fourBitMode = fourBitMode; if (rs == GpioPins.GPIO_NONE) { throw new ArgumentException("rs"); } this._registerSelectPort = new GpioFile(rs); // We can save 1 pin by not using RW. Indicate this by passing GpioPins.GPIO_NONE // instead of pin #. if (rw != GpioPins.GPIO_NONE) { this._readWritePort = new GpioFile(rw); } if (enable == GpioPins.GPIO_NONE) { throw new ArgumentException("enable"); } this._enablePort = new GpioFile(enable); GpioPins[] dataPins = { d0, d1, d2, d3, d4, d5, d6, d7 }; this._dataPorts = new GpioFile[8]; for (Int32 i = 0; i < 8; i++) { if (dataPins[i] != GpioPins.GPIO_NONE) { this._dataPorts[i] = new GpioFile(dataPins[i]); } } }
/// <summary> /// Initializes a new instance of the <see cref="CyrusBuilt.MonoPi.Components.Relays.RelayComponent"/> /// class with the <see cref="CyrusBuilt.MonoPi.IO.GpioFile"/> I/O pin to use. /// </summary> /// <param name="pin"> /// The <see cref="CyrusBuilt.MonoPi.IO.GpioFile"/> I/O pin to use. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="pin"/> cannot null. /// </exception> public RelayComponent(GpioFile pin) : base(pin) { }
/// <summary> /// Dispose this instance and release managed resources. /// </summary> /// <param name="disposing"> /// If set to <c>true</c> disposing and not finalizing. /// </param> private void Dispose(Boolean disposing) { if (this._isDisposed) { return; } if (this._registerSelectPort != null) { this._registerSelectPort.Dispose(); this._registerSelectPort = null; } if (this._readWritePort != null) { this._readWritePort.Dispose(); this._readWritePort = null; } if (this._enablePort != null) { this._enablePort.Dispose(); this._enablePort = null; } if ((this._dataPorts != null) && (this._dataPorts.Length > 0)) { for (Int32 i = 0; i < 8; i++) { if (this._dataPorts[i] != null) { this._dataPorts[i].Dispose(); } } Array.Clear(this._dataPorts, 0, this._dataPorts.Length); } if (disposing) { GC.SuppressFinalize(this); } this._isDisposed = true; }