/// <summary> /// Initializes the display for use as a big-number display. /// Configures the display with some graphic blocks for the display of big numbers. /// </summary> /// <param name="romName">Name of the character Rom, required to properly print culture-specific characters in the small text display</param> /// <param name="factory">Encoding factory or null</param> public void InitForRom(string romName, LcdCharacterEncodingFactory?factory = null) { if (factory == null) { factory = new LcdCharacterEncodingFactory(); } lock (_lock) { // Create the default encoding for the current ROM and culture, but leave the custom characters away. var encoding = factory.Create(_culture, romName, ' ', 0); Dictionary <byte, byte[]> specialGraphicsRequired = new Dictionary <byte, byte[]>(); CreateSpecialChars(specialGraphicsRequired); for (byte i = 0; i < specialGraphicsRequired.Count; i++) { _lcd.CreateCustomCharacter(i, specialGraphicsRequired[i]); } _currentSeparationChar = ' '; // To make sure the next function doesn't just skip the initialization LoadSeparationChar(_currentSeparationChar); _encoding = encoding; _lcd.BlinkingCursorVisible = false; _lcd.UnderlineCursorVisible = false; _lcd.BacklightOn = true; _lcd.DisplayOn = true; _lcd.Clear(); ReadCharacterMap(); } }
/// <summary> /// Clears the screen and sets the cursor back to the start. /// </summary> public void Clear() { lock (_lock) { _lcd.Clear(); ClearStringBuffer(); SetCursorPosition(0, 0); } }
/// <summary> /// Creates a new instance of the <see cref="LcdConsole"/> class using the specified LCD low-level interface. /// This class automatically configures the low-level interface. Do not use the low-level interface at the same time. /// </summary> /// <param name="lcd">The low-level LCD interface.</param> /// <param name="romType">Name of character ROM of display. Currently supported types: A00 and A02.</param> /// <param name="shouldDispose">If the class should dispose the LCD driver when it is disposed. Defaults to true</param> public LcdConsole(ICharacterLcd lcd, string romType, bool shouldDispose = true) { _lcd = lcd; _shouldDispose = shouldDispose; _romType = romType; _characterEncoding = null; Size = lcd.Size; _currentData = new StringBuilder[Size.Height]; CursorLeft = 0; CursorTop = 0; ScrollUpDelay = TimeSpan.Zero; _lock = new object(); _lcd.UnderlineCursorVisible = false; _lcd.BlinkingCursorVisible = false; _lcd.DisplayOn = true; _lcd.BacklightOn = true; ClearStringBuffer(); _lcd.Clear(); }