Ejemplo n.º 1
0
        /// <summary>
        /// Creates a variable of type LiquidCrystal. 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 unconnected. The RW pin can be tied to ground instead of connected to a pin on the Arduino; if so, omit it from this function's parameters.
        /// </summary>
        /// <param name="fourBitMode"></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 (optional).</param>
        /// <param name="enable">the number of the CPU pin that is connected to the enable pin on the LCD.</param>
        /// <param name="d0"></param>
        /// <param name="d1"></param>
        /// <param name="d2"></param>
        /// <param name="d3"></param>
        /// <param name="d4"></param>
        /// <param name="d5"></param>
        /// <param name="d6"></param>
        /// <param name="d7"></param>
        public RaspPiGPIOFileLcdTransferProvider(bool fourBitMode, GPIOFile.GPIOPins rs, GPIOFile.GPIOPins rw, GPIOFile.GPIOPins enable,
                                                 GPIOFile.GPIOPins d0, GPIOFile.GPIOPins d1, GPIOFile.GPIOPins d2, GPIOFile.GPIOPins d3,
                                                 GPIOFile.GPIOPins d4, GPIOFile.GPIOPins d5, GPIOFile.GPIOPins d6, GPIOFile.GPIOPins d7)
        {
            _fourBitMode = fourBitMode;

            if (rs == GPIOFile.GPIOPins.GPIO_NONE)
            {
                throw new ArgumentException("rs");
            }
            _rsPort = new GPIOFile(rs);

            // we can save 1 pin by not using RW. Indicate by passing GPIO.GPIOPins.GPIO_NONE instead of pin#
            if (rw != GPIOFile.GPIOPins.GPIO_NONE) // (RW is optional)
            {
                _rwPort = new GPIOFile(rw);
            }

            if (enable == GPIOFile.GPIOPins.GPIO_NONE)
            {
                throw new ArgumentException("enable");
            }
            _enablePort = new GPIOFile(enable);

            var dataPins = new[] { d0, d1, d2, d3, d4, d5, d6, d7 };

            _dataPorts = new GPIOFile[8];
            for (int i = 0; i < 8; i++)
            {
                if (dataPins[i] != GPIOFile.GPIOPins.GPIO_NONE)
                {
                    _dataPorts[i] = new GPIOFile(dataPins[i]);
                }
            }
        }
Ejemplo n.º 2
0
 public RaspPiGPIOFileLcdTransferProvider(GPIOFile.GPIOPins rs, GPIOFile.GPIOPins rw, GPIOFile.GPIOPins enable, GPIOFile.GPIOPins d0, GPIOFile.GPIOPins d1, GPIOFile.GPIOPins d2, GPIOFile.GPIOPins d3, GPIOFile.GPIOPins d4, GPIOFile.GPIOPins d5, GPIOFile.GPIOPins d6, GPIOFile.GPIOPins d7)
     : this(false, rs, rw, enable, d0, d1, d2, d3, d4, d5, d6, d7)
 {
 }
Ejemplo n.º 3
0
 public RaspPiGPIOFileLcdTransferProvider(GPIOFile.GPIOPins rs, GPIOFile.GPIOPins rw, GPIOFile.GPIOPins enable, GPIOFile.GPIOPins d4, GPIOFile.GPIOPins d5, GPIOFile.GPIOPins d6, GPIOFile.GPIOPins d7)
     : this(true, rs, rw, enable, GPIOFile.GPIOPins.GPIO_NONE, GPIOFile.GPIOPins.GPIO_NONE, GPIOFile.GPIOPins.GPIO_NONE, GPIOFile.GPIOPins.GPIO_NONE, d4, d5, d6, d7)
 {
 }