public LCDWrapper(GPIOPins rs, GPIOPins enable, GPIOPins d4, GPIOPins d5, GPIOPins d6, GPIOPins d7, int columns = 40, int rows = 2, DisplayMode displayMode = DisplayMode.LCD_ONLY) { DisplayMode = displayMode; Columns = columns; Rows = rows; if (DisplayMode != DisplayMode.CONSOLE_ONLY) { transferProvider = new RaspPiGPIOMemLcdTransferProvider( fourBitMode: true, rs: rs, rw: GPIOPins.GPIO_NONE, enable: enable, d0: GPIOPins.GPIO_NONE, d1: GPIOPins.GPIO_NONE, d2: GPIOPins.GPIO_NONE, d3: GPIOPins.GPIO_NONE, d4: d4, d5: d5, d6: d6, d7: d7 ); lcd = new Lcd(transferProvider); lcd.Begin(Convert.ToByte(columns), Convert.ToByte(rows)); lcd.Backlight = true; lcd.BlinkCursor = false; lcd.ShowCursor = false; lcd.Visible = true; } if(DisplayMode != DisplayMode.LCD_ONLY){ Console.Clear(); Console.ForegroundColor = ConsoleColor.White; Console.BackgroundColor = ConsoleColor.Black; Console.CursorVisible = false; } }
/// <summary> /// Initializes a new instance of the <see cref="CyrusBuilt.MonoPi.Components.LcdDisplay.LcdComponent"/> /// class with the LCD transfer provider and the rows and columns of the display. /// </summary> /// <param name="provider"> /// The LCD transfer provider. /// </param> /// <param name="rows"> /// The number of rows in the display. /// </param> /// <param name="columns"> /// The number of columns. /// </param> public LcdComponent(ILcdTransferProvider provider, Int32 rows, Int32 columns) : base() { if (provider == null) { throw new ArgumentNullException("provider"); } this._module = new LcdModule(provider); this._module.Begin(columns, rows); }
/// <summary> /// Initializes a new instance of the <see cref="CyrusBuilt.MonoPi.Components.LcdDisplay.LcdComponent"/> /// class with the LCD transfer provider and the rows and columns of the display. /// </summary> /// <param name="provider"> /// The LCD transfer provider. /// </param> /// <param name="rows"> /// The number of rows in the display. /// </param> /// <param name="columns"> /// The number of columns. /// </param> public LcdComponent(ILcdTransferProvider provider, Int32 rows, Int32 columns) : base() { if (provider == null) { throw new ArgumentNullException("provider"); } this._module = new LcdModule(provider); this._module.Begin(columns, rows); }
public Lcd(ILcdTransferProvider provider, Cpu.Pin bl = Cpu.Pin.GPIO_NONE) : base(provider) { // Using seperate port for backlight (1602 Keypad Shield) if (bl != Cpu.Pin.GPIO_NONE) // (back light is optional) { _blPort = new OutputPort(bl, true); } BackLightDuration = 2000; _backlightTimer = new Timer(TurnOffBackLight, null, BackLightDuration, Timeout.Infinite); }
public Lcd(ILcdTransferProvider provider, Cpu.Pin bl = Cpu.Pin.GPIO_NONE) : base(provider) { // Using seperate port for backlight (1602 Keypad Shield) if (bl != Cpu.Pin.GPIO_NONE) // (back light is optional) { _blPort = new OutputPort(bl, true); } BackLightDuration = 2000; _backlightTimer = new Timer(TurnOffBackLight, null, BackLightDuration, Timeout.Infinite); }
public Lcd(ILcdTransferProvider provider) { Encoding = Encoding.UTF8; if (provider == null) throw new ArgumentNullException("provider"); _provider = provider; if (_provider.FourBitMode) _displayFunction = LCD_4BITMODE | LCD_1LINE | LCD_5x8DOTS; else _displayFunction = LCD_8BITMODE | LCD_1LINE | LCD_5x8DOTS; Begin(16, 1); }
// ReSharper restore InconsistentNaming #endregion public Lcd(ILcdTransferProvider provider) { Encoding = Encoding.UTF8; _provider = provider ?? throw new ArgumentNullException("provider"); if (_provider.FourBitMode) { _displayFunction = LCD_4BITMODE | LCD_1LINE | LCD_5x8DOTS; } else { _displayFunction = LCD_8BITMODE | LCD_1LINE | LCD_5x8DOTS; } Begin(16, 1); }
/// <summary> /// Initializes a new instance of the <see cref="CyrusBuilt.MonoPi.LCD.LcdModule"/> /// class with the LCD transfer provider. /// </summary> /// <param name="provider"> /// The LCD transfer provider. /// </param> public LcdModule(ILcdTransferProvider provider) { if (provider == null) { throw new ArgumentNullException("provider"); } this._provider = provider; if (this._provider.FourBitMode) { this._displayFunction = ((Byte)FunctionSetFlags.FourBitMode | (Byte)FunctionSetFlags.OneLine | (Byte)FunctionSetFlags.FiveByEightDots); } else { this._displayFunction = ((Byte)FunctionSetFlags.EightBitMode | (Byte)FunctionSetFlags.OneLine | (Byte)FunctionSetFlags.FiveByEightDots); } }
/// <summary> /// Constructor /// </summary> /// <param name="provider">LCD Transfer Provider to use for transferring data to LCD</param> public Lcd(ILcdTransferProvider provider) { if (provider == null) { throw new ArgumentException("LCD Transfer Provider is necessary"); } this.provider = provider; // default set : display 1 line and character font 5 x 8 dots this.functionSet = DISPLAY_LINES_1LINE | CHAR_FONT_5x8DOTS; // set 4 or 8 bits interface data mode this.functionSet |= (provider.InterfaceDataMode == InterfaceDataMode._8Bit) ? DATA_LENGTH_8BIT : DATA_LENGTH_4BIT; this.lines = 1; this.columns = 16; // initialize default 1 x 16 display with 5x8 dots charanters this.Initialize(CharacterFont.Dots5x8, 1, 16); }
/// <summary> /// Initializes a new instance of the <see cref="CyrusBuilt.MonoPi.LCD.LcdModule"/> /// class with the LCD transfer provider. /// </summary> /// <param name="provider"> /// The LCD transfer provider. /// </param> public LcdModule(ILcdTransferProvider provider) { if (provider == null) { throw new ArgumentNullException("provider"); } this._provider = provider; if (this._provider.FourBitMode) { this._displayFunction = ((Byte)FunctionSetFlags.FourBitMode | (Byte)FunctionSetFlags.OneLine | (Byte)FunctionSetFlags.FiveByEightDots); } else { this._displayFunction = ((Byte)FunctionSetFlags.EightBitMode | (Byte)FunctionSetFlags.OneLine | (Byte)FunctionSetFlags.FiveByEightDots); } }
/// <summary> /// Constructor /// </summary> /// <param name="provider">LCD Transfer Provider to use for transferring data to LCD</param> public Lcd(ILcdTransferProvider provider) { if (provider == null) throw new ArgumentException("LCD Transfer Provider is necessary"); this.provider = provider; // default set : display 1 line and character font 5 x 8 dots this.functionSet = DISPLAY_LINES_1LINE | CHAR_FONT_5x8DOTS; // set 4 or 8 bits interface data mode this.functionSet |= (provider.InterfaceDataMode == InterfaceDataMode._8Bit) ? DATA_LENGTH_8BIT : DATA_LENGTH_4BIT; this.lines = 1; this.columns = 16; // initialize default 1 x 16 display with 5x8 dots charanters this.Initialize(CharacterFont.Dots5x8, 1, 16); }