I have updated the HX8357 library here to include an example which draws bitmaps off an SD Card. The test images are stored in the "extras" folder within the library.
Also new member functions have been added to draw outline ellipses and filled ellipses, a new example is included.
the text that it draws is not of size 2, as it is defined in the function but 6. In order this to work we have to call the tft.setTextSize(2) in order the font to be printed at a size of two.
I can't reproduce the bug, check if the sketch is writing past the end of the charBuf array when filling it... Can you post a complete simplified example sketch that fails?
If you want to save power then ideally we would turn off the LEDs, but unfortunately the backlight LEDs are hard wired on the PCB tot he 5V power line.
The TFT driver can be put into a power down state via a command but the LED's are the big consumer.
It would be possible to hack the board and add a transistor to control the LED power but that required some electronics hardware knowledge and additional parts.
If you want to save power then ideally we would turn off the LEDs, but unfortunately the backlight LEDs are hard wired on the PCB tot he 5V power line.
The TFT driver can be put into a power down state via a command but the LED's are the big consumer.
It would be possible to hack the board and add a transistor to control the LED power but that required some electronics hardware knowledge and additional parts.
Thanks for the quick reply, I was wanting to save power on a battery based project, I did want to shut off the backlight. I'll look at using a transistor to shut off the entire system, including the Mega (it's just a backup for if a user forgets to turn it off after use). Thanks again.
asghar144:
I want to know if we can use shift registars with this lcd to save IO pins on Mega 2560?
on SPI or I2C Interface.
Yes, but you would need to build a suitable circuit and make significant changes to the library or write your own. I don't think it would be worth the effort and display updates would end up being quite slow in comparison to the faster 16 bit parallel interface. It would be easier to find a suitable SPI display and compatible library.
The Mega has a lot of digital I/O pins so I am surprised you are running out!
The library has been updated to work with mcufriend 3.5" displays that use a 16 bit interface and the ILI9486 driver. More details on the display in this thread. Note that the PCB in this case indicates a ILI9488 driver but that is misleading.
I want make a cursor line on the tft screen. It is a line with inverse colors.
Need a function that returns the color of the pixel on the screen.
Something like this: TColor GetColor(int x,int y);
How to do it?
It is very simple to make an inverse cursor if you can read the screen.
Unfortunately, most of these 16-bit shields are write-only.
So you would have to keep a copy of whatever you wrote onto the screen. And then write the inverse.
This would be ok if you have a big RAM to store your screen contents. e.g. 320x480x16 bits = 307200 bytes.
If your cursor position is always known, you can get away with a smaller buffer e.g. the length of the cursor x 2 bytes. Just redraw the background. Much like in the analog meter examples. e.g. repaint the old background, draw the new meter needle.
You can implement your idea easily on Mcufriend Uno shields with my library. No extra RAM is needed but it will be quicker if you do it in say 16-pixel chunks.
An inverse colour is a "NOT" of all bits, so !TFT_RED will display as cyan.
Thus you can simply set the text foreground and background colours as the inverse of the text you would otherwise print at the cursor. The cursor can be simply a "space" or an underscore "_". If you really want you can even flash the cursor by overprinting with normal and inverse colours in a delay loop.
An inverse colour is a "NOT" of all bits, so !TFT_RED will display as cyan.
Thus you can simply set the text foreground and background colours as the inverse of the text you would otherwise print at the cursor. The cursor can be simply a "space" or an underscore "_". If you really want you can even flash the cursor by overprinting with normal and inverse colours in a delay loop.
Need is the graphics cursor (a vertical inverse line over the graph of a function). That is needed a function of reading the color of a specific point of the video memory. But if screen video memory is write-only, the question is removed.