David Johnson-Davies’ Tiny TFT Graphics Library Beneficial properties an Odd New Means: Studying From Shows

0
8



David Johnson-Davies has added a brand new function to his Tiny TFT Graphics Library, and it is one which works precisely backwards to the best way you’d anticipate: it reads from, relatively than writes to, a suitable show panel.

“[This] extension to my Tiny TFT Graphics Library to mean you can learn pixels from the show,” Johnson-Davies explains of the brand new replace. “It really works with TFT shows out there from AliExpress. Having the ability to learn pixels from the show lets you do a number of issues that would not in any other case be attainable.”

Studying from relatively than writing to a show may not sound that helpful, however Johnson-Davies makes some sound arguments for its utility courtesy of 4 pattern functions. The primary is a digital kaleidoscope, which cuts a triangle from an current display screen picture after which displays it to create a symmetrical model. A stopwatch, in the meantime, makes use of exclusive-OR (XOR) capabilities to take away and redraw the hand because it strikes as soon as a second, with out forsaking any corruption of the background clock face.

One other pattern reveals how the extension might be utilized in gaming, bouncing a ball between two paddles like a sport of Pong — detecting when the ball hits the paddle and bouncing it again off. The ultimate pattern utility, in the meantime, permits for capturing no matter is at present on the show as a bitmap and saving it to an SD Card.

“To implement these functions with out the flexibility to learn pixels from the show would require you to maintain a mirror of the show in RAM, and replace the mirror each time you draw to the precise show,” Johnson-Davies explains. “This is able to decelerate graphics and require a whole lot of reminiscence: for instance, to reflect a 320Ă—240 shade show would require 153.6kbytes of RAM. To place this in context, the ATtiny414 used to run these examples solely has 256 bytes of RAM.”

The extension is suitable with a variety of TFT shows based mostly on ST7735, ST7735R, ST7789, and ST7789V controllers; it’s not, nevertheless, suitable with Adafruit’s vary of TFT shows. “The reason being that their shows all embody a unidirectional on-board logic-level converter to permit them for use with both 3.3V or 5V,” Johnson-Davies says, “however this has the draw back of stopping them from having the ability to learn again from the show reminiscence.”

Extra particulars can be found on Johnson-Davies’ weblog, together with the supply code for the modified Tiny TFT Graphics Library below a permissive Artistic Commons Attribution 4.0 Worldwide license.

LEAVE A REPLY

Please enter your comment!
Please enter your name here