LoBo Forums

Full Version: small add to display module
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is it possible that tft.image(x, y, file [,scale, type]) will return a bytearray of the image as well as writing the image to the screen. The reason that I ask is I want to  be able to load up a back ground image to the screen but also have a bytearry of it in memory so when I put any other smaller images or text on top of the background image I can restore any part of the background image I want from the bytearry.

backgound_image = memoryview(tft.image(x, y, file [,scale, type]))
I'm working on two new functions:

tft.readScreen(x, y, w, h [,buffer])
tft.writeScreen(x, y, w, h ,buffer)

which will read/write the screen memory (full or part of the screen) to/from the buffer.

Using them, you can display the image (jpg) on the screen, then read the raw screen memory into the buffer and write it (or part of it) back to the screen when needed.

As the 240x320 screen needs 230400 bytes buffer size (full screen), it will be usable only if SPIRAM is used.
128x160 screen in 16-bit mode needs 40960 bytes, so probably it could be used without SPIRAM.

The display module should be updated by the end of the week.
Very much thanks for all your hard work on this very excellent display module.

It is also possible that it can be added that not only can read from the screen to the buffer but when loading image from file it can also be written to buffer??

The reason that I ask is that I usually don't connect the MISO pin on my TFT as most of these cheap screens only have 1 data pin that is both MOSI and MISO which means if I connect both MISO and MOSI to this data pin then anything else that I put on the same SPI bus will have the MISO and MOSI shorted and this is a problem for when I need to write to MOSI and read MISO at the same time to another chip that is on the same SPI bus like in my driver for LS7366R I use spi.write_readinto(cmd, res)



I just connect the MOSI to the data pin on my boards and if the user needs to use MISO they can just add a jumper wire between the MISO and MOSI on the breakout header.

Even if there was a mod to tft.image(x, y, file [,scale, type]) where there was 1 more argument passed that defines whether it writes to the screen or writes to a buffer. Because if I can load to a buffer instead of screen then after it is loaded to the buffer then I can execute tft.writeScreen(x, y, w, h ,buffer)
(05-16-2018, 07:55 PM)lobo Wrote: [ -> ]I'm working on two new functions:

tft.readScreen(x, y, w, h [,buffer])
tft.writeScreen(x, y, w, h ,buffer)

Hi,
Just wondering if the tft.writeScreen is implemented yet, or if there is another way to re-display a saved screen area ?

Ive looked, but I've not been able to identify anything else that would be able to handle the buffer format.

/jos