Пример #1
0
        /// <summary>
        /// Initializes one of the eight Custom Characters that are available to the SerialLCD.
        /// </summary>
        /// <param name="characters">The <see cref="UserCharacters"/> to setup.</param>
        /// <param name="characterBytes">The byte pattern representing the 5x7 matrix.</param>
        /// <example>Example usage:
        /// <code language = "C#">
        ///  var bell = new Byte[] {4, 14, 14, 14, 31, 31, 4, 0};
        /// _lcd.SetUserCharacter(SerialLCD.UserCharacters.UserCharacter1, bell);
        /// // To display the bell characters
        ///  _lcd.PutC((byte)SerialLCD.UserCharacters.UserCharacter1, 0, 0);
        /// </code>
        /// <code language = "VB">
        /// Dim bell = New [Byte]() {4, 14, 14, 14, 31, 31, 4, 0}
        /// _lcd.SetUserCharacter(SerialLCD.UserCharacters.UserCharacter1, bell)
        /// ' To display the bell characters
        /// _lcd.PutC(CByte(SerialLCD.UserCharacters.UserCharacter1), 0, 0)
        /// </code>
        /// </example>
        public void SetUserCharacter(UserCharacters characters, byte[] characterBytes)
        {
            switch (characters)
            {
            case UserCharacters.UserCharacter1:
                _userChartacterOne = characterBytes;
                break;

            case UserCharacters.UserCharacter2:
                _userChartacterTwo = characterBytes;
                break;

            case UserCharacters.UserCharacter3:
                _userChartacterThree = characterBytes;
                break;

            case UserCharacters.UserCharacter4:
                _userChartacterFour = characterBytes;
                break;

            case UserCharacters.UserCharacter5:
                _userChartacterFive = characterBytes;
                break;

            case UserCharacters.UserCharacter6:
                _userChartacterSix = characterBytes;
                break;

            case UserCharacters.UserCharacter7:
                _userChartacterSeven = characterBytes;
                break;

            case UserCharacters.UserCharacter8:
                _userChartacterEight = characterBytes;
                break;
            }
        }
Пример #2
0
 public void AddCharacter(Character character)
 {
     character.CharacterId = UserCharacters.Count == 0 ? 1 : UserCharacters.Max(x => x.CharacterId) + 1;
     UserCharacters.Add(character);
 }