Example #1
0
        /// <summary>
        /// Clears the display.
        /// </summary>
        public void Clear()
        {
            WriteCommand(Command.ClearDisplay);
            currentPosition = Hd44780Position.Zero;

            Timer.Sleep(TimeSpan.FromMilliseconds(3)); // Clearing the display takes a long time
        }
Example #2
0
        /// <summary>
        /// Set cursor to top left corner.
        /// </summary>
        public void Home()
        {
            WriteCommand(Command.ReturnHome);
            currentPosition = Hd44780Position.Zero;

            Timer.Sleep(TimeSpan.FromMilliseconds(3));
        }
Example #3
0
        /// <summary>
        /// Moves the cursor to the specified row and column
        /// </summary>
        /// <param name="position">The position.</param>
        public void SetCursorPosition(Hd44780Position position)
        {
            var row = position.Row;

            if (row < 0 || height <= row)
            {
                row = height - 1;
            }

            var column = position.Column;

            if (column < 0 || width <= column)
            {
                column = width - 1;
            }

            var address = column + GetLcdAddressLocation(row);

            WriteByte(address, false);

            currentPosition = new Hd44780Position {
                Row = row, Column = column
            };
        }