Exemple #1
0
        /// <summary>
        /// Initializes a HD44780 compatible LCD with a parallel output port
        /// </summary>
        /// <param name="Data">Data port</param>
        /// <param name="ClockEnablePin">Clock enable pin</param>
        /// <param name="RegisterSelectPin">Register select pin</param>
        /// <param name="ReadWritePin">Read/write pin (optional; this driver is always in 'write' mode)</param>
        /// <param name="Columns">The amount of columns (default: 16)</param>
        /// <param name="Rows">The amount of rows (default: 2)</param>
        public Hd44780Lcd(IParallelOut Data, Cpu.Pin ClockEnablePin, Cpu.Pin RegisterSelectPin, Cpu.Pin ReadWritePin = Cpu.Pin.GPIO_NONE, int Columns = 16, int Rows = 2)
        {
            // Validates parameters
            if (Data.Size != 4)
            {
                throw new ArgumentOutOfRangeException("Can only use 4-bit data blocks right now");
            }

            // Copies all references locally
            this._Data   = Data;
            this._CePin  = new IntegratedGPO(ClockEnablePin);
            this._RsPin  = new IntegratedGPO(RegisterSelectPin);
            this._RwPin  = ReadWritePin == Cpu.Pin.GPIO_NONE ? null : new IntegratedGPO(ReadWritePin);
            this.Rows    = Rows;
            this.Columns = Columns;

            // Since we are referring to a data block, we're not in pin mode
            this._PinMode = false;

            // Since we use real pins, disposal is required
            this._PinDisposalRequired = true;

            // Starts the LCD initialization
            this._Initialization();
        }
Exemple #2
0
        /// <summary>
        /// Initializes a HD44780 compatible LCD with a parallel output port
        /// </summary>
        /// <param name="Data">Data port</param>
        /// <param name="ClockEnablePin">Clock enable pin</param>
        /// <param name="RegisterSelectPin">Register select pin</param>
        /// <param name="ReadWritePin">Read/write pin (optional; this driver is always in 'write' mode)</param>
        /// <param name="Columns">The amount of columns (default: 16)</param>
        /// <param name="Rows">The amount of rows (default: 2)</param>
        public Hd44780Lcd(IParallelOut Data, IGPOPort ClockEnablePin, IGPOPort RegisterSelectPin, IGPOPort ReadWritePin = null, int Columns = 16, int Rows = 2)
        {
            // Validates parameters
            if (Data.Size != 4)
            {
                throw new ArgumentOutOfRangeException("Can only use 4-bit data blocks right now");
            }

            // Copies all references locally
            this._Data   = Data;
            this._CePin  = ClockEnablePin;
            this._RsPin  = RegisterSelectPin;
            this._RwPin  = ReadWritePin;
            this.Rows    = Rows;
            this.Columns = Columns;

            // Since we are referring to a data block, we're not in pin mode
            this._PinMode = false;

            // Since we use virtual pins, disposal isn't required
            this._PinDisposalRequired = false;

            // Starts the LCD initialization
            this._Initialization();
        }
        /// <summary>
        /// Initalises a 7-segment display on a parallel port
        /// </summary>
        /// <param name="ParallelPort">The parallel port (requires at least 8 pins)</param>
        /// <param name="CommonAnode">Specifies if the 7-segment is common anode</param>
        public SevenSegment(IParallelOut ParallelPort, bool CommonAnode = true)
        {
            if (ParallelPort.Size < 8) throw new ArgumentException("The parallel port has less then 8 pins");

            this._ParallelPort = ParallelPort;
            this._CommonAnode = CommonAnode;
        }
Exemple #4
0
        /// <summary>
        /// Initalises a 7-segment display on a parallel port
        /// </summary>
        /// <param name="ParallelPort">The parallel port (requires at least 8 pins)</param>
        /// <param name="CommonAnode">Specifies if the 7-segment is common anode</param>
        public SevenSegment(IParallelOut ParallelPort, bool CommonAnode = true)
        {
            if (ParallelPort.Size < 8)
            {
                throw new ArgumentException("The parallel port has less then 8 pins");
            }

            this._ParallelPort = ParallelPort;
            this._CommonAnode  = CommonAnode;
        }
        /// <summary>
        /// Initializes a HD44780 compatible LCD with a parallel output port
        /// </summary>
        /// <param name="Data">Data port</param>
        /// <param name="ClockEnablePin">Clock enable pin</param>
        /// <param name="RegisterSelectPin">Register select pin</param>
        /// <param name="ReadWritePin">Read/write pin (optional; this driver is always in 'write' mode)</param>
        /// <param name="Columns">The amount of columns (default: 16)</param>
        /// <param name="Rows">The amount of rows (default: 2)</param>
        public Hd44780Lcd(IParallelOut Data, Cpu.Pin ClockEnablePin, Cpu.Pin RegisterSelectPin, Cpu.Pin ReadWritePin = Cpu.Pin.GPIO_NONE, int Columns = 16, int Rows = 2)
        {
            // Validates parameters
            if (Data.Size != 4) throw new ArgumentOutOfRangeException("Can only use 4-bit data blocks right now");

            // Copies all references locally
            this._Data = Data;
            this._CePin = new IntegratedGPO(ClockEnablePin);
            this._RsPin = new IntegratedGPO(RegisterSelectPin);
            this._RwPin = ReadWritePin == Cpu.Pin.GPIO_NONE ? null : new IntegratedGPO(ReadWritePin);
            this.Rows = Rows;
            this.Columns = Columns;

            // Since we are referring to a data block, we're not in pin mode
            this._PinMode = false;

            // Since we use real pins, disposal is required
            this._PinDisposalRequired = true;

            // Starts the LCD initialization
            this._Initialization();
        }
        /// <summary>
        /// Initializes a HD44780 compatible LCD with a parallel output port
        /// </summary>
        /// <param name="Data">Data port</param>
        /// <param name="ClockEnablePin">Clock enable pin</param>
        /// <param name="RegisterSelectPin">Register select pin</param>
        /// <param name="ReadWritePin">Read/write pin (optional; this driver is always in 'write' mode)</param>
        /// <param name="Columns">The amount of columns (default: 16)</param>
        /// <param name="Rows">The amount of rows (default: 2)</param>
        public Hd44780Lcd(IParallelOut Data, IGPOPort ClockEnablePin, IGPOPort RegisterSelectPin, IGPOPort ReadWritePin = null, int Columns = 16, int Rows = 2)
        {
            // Validates parameters
            if (Data.Size != 4) throw new ArgumentOutOfRangeException("Can only use 4-bit data blocks right now");

            // Copies all references locally
            this._Data = Data;
            this._CePin = ClockEnablePin;
            this._RsPin = RegisterSelectPin;
            this._RwPin = ReadWritePin;
            this.Rows = Rows;
            this.Columns = Columns;

            // Since we are referring to a data block, we're not in pin mode
            this._PinMode = false;

            // Since we use virtual pins, disposal isn't required
            this._PinDisposalRequired = false;

            // Starts the LCD initialization
            this._Initialization();
        }