예제 #1
0
        private static (ITextDisplayDevice, IDisposable) Create(IGpioConnectionDriverFactory gpioConnectionDriverFactory)
        {
            var hd44780LcdDeviceSettings = new Hd44780LcdDeviceSettings
            {
                ScreenHeight = 2,
                ScreenWidth  = 16,
                Encoding     = new Hd44780A00Encoding(),
                SyncDelay    = TimeSpan.FromMilliseconds(10),
            };
            var hd44780LcdDevice = new Hd44780LcdDevice(
                hd44780LcdDeviceSettings,
                gpioConnectionDriverFactory,
                ConnectorPin.P1Pin29,
                ConnectorPin.P1Pin32,
                new Hd44780DataPins(
                    ConnectorPin.P1Pin31,
                    ConnectorPin.P1Pin33,
                    ConnectorPin.P1Pin35,
                    ConnectorPin.P1Pin37));

            return(new Hd44780TextDisplayDevice(hd44780LcdDevice, hd44780LcdDeviceSettings), hd44780LcdDevice);
        }
예제 #2
0
        /// <summary>
        /// Creates the specified gpio connection driver.
        /// </summary>
        /// <param name="gpioConnectionDriverFactory">The gpio connection driver factory.</param>
        /// <param name="hasBacklight">if set to <c>true</c> [has backlight].</param>
        /// <returns>
        /// A <see cref="Hd44780Display" />.
        /// </returns>
        public IDisplay Create(IGpioConnectionDriverFactory gpioConnectionDriverFactory, bool hasBacklight)
        {
            var hd44780LcdDeviceSettings = new Hd44780LcdDeviceSettings
            {
                ScreenHeight = 2,
                ScreenWidth  = 16,
                Encoding     = new Hd44780A00Encoding(),
            };
            var backlight        = hasBacklight ? new ConnectorPin?(ConnectorPin.P1Pin26) : null;
            var hd44780LcdDevice = new Hd44780LcdDevice(
                hd44780LcdDeviceSettings,
                gpioConnectionDriverFactory,
                ConnectorPin.P1Pin29,
                ConnectorPin.P1Pin32,
                new Hd44780DataPins(
                    ConnectorPin.P1Pin31,
                    ConnectorPin.P1Pin33,
                    ConnectorPin.P1Pin35,
                    ConnectorPin.P1Pin37),
                backlight);

            return(this.textDisplayDevices.Add(new Hd44780Display(hd44780LcdDevice, hd44780LcdDeviceSettings), hd44780LcdDevice));
        }
예제 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CharacterContext" /> class.
 /// </summary>
 /// <param name="hd44780LcdDevice">The HD44780 LCD connection.</param>
 /// <param name="patternSize">Size of the pattern.</param>
 public CharacterContext(Hd44780LcdDevice hd44780LcdDevice, Size patternSize)
 {
     this.PatternSize      = patternSize;
     this.hd44780LcdDevice = hd44780LcdDevice;
 }
예제 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Hd44780Display"/> class.
 /// </summary>
 /// <param name="hd47780LcdDevice">The HD47780 connection.</param>
 /// <param name="hd47780LcdDeviceSettings">The HD47780 connection settings.</param>
 public Hd44780Display(Hd44780LcdDevice hd47780LcdDevice, Hd44780LcdDeviceSettings hd47780LcdDeviceSettings)
     : base(hd47780LcdDevice, hd47780LcdDeviceSettings)
 {
     this.hd47780LcdDevice = hd47780LcdDevice;
 }
예제 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Hd44780TextDisplayDevice"/> class.
 /// </summary>
 /// <param name="hd44780LcdDevice">The HD44780 LCD device.</param>
 /// <param name="settings">The settings.</param>
 public Hd44780TextDisplayDevice(Hd44780LcdDevice hd44780LcdDevice, Hd44780LcdDeviceSettings settings)
 {
     this.hd44780LcdDevice = hd44780LcdDevice;
     this.settings         = settings;
     this.Size             = new Size(this.settings.ScreenWidth, this.settings.ScreenHeight);
 }