/// <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> /// Creates an encoding that can be used for an LCD display. /// Typically, the returned value will be loaded using <see cref="LoadEncoding(LcdCharacterEncoding)"/>. /// </summary> /// <param name="culture">Required display culture (forwarded to the factory)</param> /// <param name="romType">The name of the ROM for which the encoding is to be applied. The default factory supports roms A00 and A02.</param> /// <param name="unknownCharacter">The character to print for unknown letters, default: ?</param> /// <param name="maxNumberOfCustomCharacters">The maximum number of custom characters supported by the hardware.</param> /// <param name="factory">Character encoding factory that delivers the mapping of the Char type to the hardware ROM character codes. May add special characters into /// the character ROM. Default: Null (Use internal factory)</param> public static LcdCharacterEncoding CreateEncoding(CultureInfo culture, string romType, char unknownCharacter = '?', int maxNumberOfCustomCharacters = 8, LcdCharacterEncodingFactory factory = null) { if (factory == null) { factory = new LcdCharacterEncodingFactory(); } return(factory.Create(culture, romType, unknownCharacter, maxNumberOfCustomCharacters)); }