I must be thick… If I want to render the letter “A” in my custom font (assuming I already created the bitmap for “A” in my C code) at position 221x 115y, what would the code sequence look like?
Load_Char(0, myCustomAArray);
FontWrite_Position(221, 115);
// how do I tell it to actually draw the loaded font charter here?
Last one – font size/scale. By default, they’re 8×16. What if I wanted 2x, 3x, etc? I thinks there’s another LCD command for this, or would/could we define a larger custom font array?
Thats what i plan to look into next. I have some 16×16 fonts i would love to try. There are only 255 spots in the font available so larger fonts will be shortened to less characters.
Was looking at your git code again, and I don’t see where you actually draw your buttons on the LCD. I see the Init code that sets position, but don’t see where you actually draw them? Are you just rendering one big static BMP and then mapping touch locations that correspond with areas in the BMP?
I actually do both. The volume and channels are drawn individually as they have 3 states. The other buttons are 1 large image and individual sections are drawn based on touch. Check the ta8875.c file for openasi.. asi is my own custom file type
I havent used this with Arduino, sorry. But it shouldnt be to hard to implement it. The code should be almost copy and paste-able. Do you have arduino code made for the LCD already? I can add my code to it for you.
It uses SPI/I2C/Parallel interface, Depends on which one you use. If SPI.. Then 4 SPI lines… If you get the Capacitive Touch version like me then you will also need I2C for the touch screen. It doesnt use 40-50 lines.
Check this out: (MCU they chose is the STC12LE5A60S2)
Awesome! One question – how do you specify the x-y position to draw the font at?
Its in the lcd code .. thats normal stuff…
////////////////Text write position
void FontWrite_Position(uint X,uint Y)
{
unsigned char temp;
temp=X;
LCD_CmdWrite(0x2A);
LCD_DataWrite(temp);
temp=X>>8;
LCD_CmdWrite(0x2B);
LCD_DataWrite(temp);
temp=Y;
LCD_CmdWrite(0x2C);
LCD_DataWrite(temp);
temp=Y>>8;
LCD_CmdWrite(0x2D);
LCD_DataWrite(temp);
}
I must be thick… If I want to render the letter “A” in my custom font (assuming I already created the bitmap for “A” in my C code) at position 221x 115y, what would the code sequence look like?
Load_Char(0, myCustomAArray);
FontWrite_Position(221, 115);
// how do I tell it to actually draw the loaded font charter here?
Hah i guess i should add that to the PDF… ASCII is simple enough most drawable characters are from 32 to 126 aka SPACE to ~ …
To make it simple you can draw the letter A (capital) in its position which is 65.
Load_Char(65,newACharacter);
Write_Dir(0x40,0x80);//Set the character mode
Write_Dir(0x21,0x80);//Select the internal CGRAM
FontWrite_Position(221,115);
String(“A”);
If you are just loading a symbol such as the BATTERY symbol then keeping it in place doesnt matter. So you can start at 0 like:
Load_Char(0,batt);
Write_Dir(0x40,0x80);//Set the character mode
Write_Dir(0x21,0x80);//Select the internal CGRAM
FontWrite_Position(221,115);
String(0);
You rock! This is exactly what I was looking for.
Last one – font size/scale. By default, they’re 8×16. What if I wanted 2x, 3x, etc? I thinks there’s another LCD command for this, or would/could we define a larger custom font array?
Thats what i plan to look into next. I have some 16×16 fonts i would love to try. There are only 255 spots in the font available so larger fonts will be shortened to less characters.
I updated the PDF and im glad this helped!
I’m guessing that font scaling would probably not look so great, and would probably be better of just drawing a pre-scaled bitmap for large sizes.
yeah, or you can draw it on a few font positions and then line them up .. it shows it in the PDF as a image
Was looking at your git code again, and I don’t see where you actually draw your buttons on the LCD. I see the Init code that sets position, but don’t see where you actually draw them? Are you just rendering one big static BMP and then mapping touch locations that correspond with areas in the BMP?
I actually do both. The volume and channels are drawn individually as they have 3 states. The other buttons are 1 large image and individual sections are drawn based on touch. Check the ta8875.c file for openasi.. asi is my own custom file type
The .asi files are on the SD card wired to the mcu?
Yep..
Why do you need to do an SPI__WRITE(0) before each row of 16-bit color data? I don’t see that in the spec?
Not sure if you are talking about the asi functions of so that’s to set the mode to write data since I dont use rw or rs pins.
Yeah. Couldn’t it just be sent once per entire image byte array, rather than for each pixel row?
possibly if the image is tiny. Im using SPI for SD also so i have to deselect the chip and im not sure if it looses that state. So i just resend it.
I see
hello,
how can I apply this in Arduino? per exemple
I havent used this with Arduino, sorry. But it shouldnt be to hard to implement it. The code should be almost copy and paste-able. Do you have arduino code made for the LCD already? I can add my code to it for you.
Hi Jason, Very nice.
Two questions:
1) Where did you order this TFT from?
2) How many pins does it consume to run properly (40, 50) ?
Hey buddy! I got the screen from : http://www.buydisplay.com/default/7-inch-lcd-module-capacitive-touch-screen-panel-i2c-spi-serial.html
It uses SPI/I2C/Parallel interface, Depends on which one you use. If SPI.. Then 4 SPI lines… If you get the Capacitive Touch version like me then you will also need I2C for the touch screen. It doesnt use 40-50 lines.
Check this out: (MCU they chose is the STC12LE5A60S2)
Click to access ER-TFTM070-5_Interfacing.pdf