visrealm/vrEmuLcd

createChar function to save special character in the LCD and write it back to the screen when needed

Closed this issue · 1 comments

Hi, first i would like to let you know that this piece of software if pretty cool and work amazingly well! I am using it to emulate what i see on my real LCD i use 20 x 4 character LCD.
On arduino library with those HD44... LCD, we can create special char base on a byte array and save it in the LCD memory and be able to use it whenever we need it!

Is there any way to do the same with your code? I have those special char to create and show depending on the wifi signal force!

byte rssi0[8] = {
B00000,
B00000,
B00000,
B00000,
B00000,
B00000,
B00000,
B00000
};

byte rssi1[8] = {
  B00000,
  B00000,
  B00000,
  B00000,
  B00000,
  B00000,
  B11000,
  B11000
};

byte rssi2[8] = {
  B00000,
  B00000,
  B00000,
  B00000,
  B00011,
  B00011,
  B11011,
  B11011
};

byte rssi3[8] = {
  B00000,
  B00000,
  B11000,
  B11000,
  B11000,
  B11000,
  B11000,
  B11000
};

byte rssi4[8] = {
  B00011,
  B00011,
  B11011,
  B11011,
  B11011,
  B11011,
  B11011,
  B11011
};

Thanx a lot!

Hi, sorry for the lengthy delay.

Yes. custom characters are supported. There is no special API for them though, so it's a matter of sending commands to the LCD like you would a physical character LCD. You need to use .sendCommand(LCD_CMD_SET_CGRAM_ADDR); to set the current address to the start of CGRAM (character 0), then send your custom character data in a loop. eg:

for (int i = 0; i < 8; ++i) { lcd.sendByte(rssi0[i]); }
Probably better off making that a function that takes an array of bytes, but that will work as is (for rssi0).

Then set the current address back to a DRAM address and write your character values.

Hope that helps.

Cheers
Troy