ili9341 various macros

For general Flowcode discussion that does not belong in the other sections.
Post Reply
jollybv
Posts: 125
http://meble-kuchenne.info.pl
Joined: Mon Mar 08, 2021 11:25 am
Location: Cape Town South Africa
Has thanked: 40 times
Been thanked: 11 times

ili9341 various macros

Post by jollybv »

Hi Guys

Can someone please explain what the window macro in the ili9341 does as I've tried it out but nothing happens.

BenR
Matrix Staff
Posts: 1707
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 435 times
Been thanked: 598 times

Re: ili9341 various macros

Post by BenR »

Hello,

The Window macro basically defines an area of the display where pixel data will be drawn.

Macros like plot will create a window of 1x1 pixel before sending the foreground colour.

Macros like fastplot will just send the colour without creating the window.

jollybv
Posts: 125
Joined: Mon Mar 08, 2021 11:25 am
Location: Cape Town South Africa
Has thanked: 40 times
Been thanked: 11 times

Re: ili9341 various macros

Post by jollybv »

Thanks Ben

Is there a way to draw a triangle like an up down arrow or a button with rounded corners? I have tried the ellipse but dose not give me the results I'm looking for.

BenR
Matrix Staff
Posts: 1707
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 435 times
Been thanked: 598 times

Re: ili9341 various macros

Post by BenR »

Hello,

An arrow could be done using lines or plot points.

Arrow.jpg
Arrow.jpg (7.26 KiB) Viewed 1868 times

A rounded box could be done by adding black lines to the outside of a rectangle and white to the inside as shown here. This is a bad example hand drawn by me but shows you what kind of things you can do.

Rounded Box.jpg
Rounded Box.jpg (5.4 KiB) Viewed 1868 times

Here's a much better example from the web.

Rounded2.jpg
Rounded2.jpg (3.84 KiB) Viewed 1867 times

Ideally you use COS and SIN to do the X,Y dims for you.

If you think these are something that should be standard on all GLCDs then let us know and we can maybe investigate.

jollybv
Posts: 125
Joined: Mon Mar 08, 2021 11:25 am
Location: Cape Town South Africa
Has thanked: 40 times
Been thanked: 11 times

Re: ili9341 various macros

Post by jollybv »

Hi Ben

Sorry for the delayed reply as I have been away for a few days. It would be great if you could make it standard in the GLCDs as I'm not an advanced programmer like many others and have no clue how to use COS & SIN as of yet.

jollybv
Posts: 125
Joined: Mon Mar 08, 2021 11:25 am
Location: Cape Town South Africa
Has thanked: 40 times
Been thanked: 11 times

Re: ili9341 various macros

Post by jollybv »

Hi Guys

Is it possible to use sprites in flowcode as per video
https://www.youtube.com/watch?v=sRGXQg7 ... f&index=16

BenR
Matrix Staff
Posts: 1707
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 435 times
Been thanked: 598 times

Re: ili9341 various macros

Post by BenR »

Hello,

Yes bitmaps can currently be used using the Bitmap Drawer components. Is this what you need?

I've also spotted a lib for doing antialiased rounded rectangles so just need to get my head around it.

jollybv
Posts: 125
Joined: Mon Mar 08, 2021 11:25 am
Location: Cape Town South Africa
Has thanked: 40 times
Been thanked: 11 times

Re: ili9341 various macros

Post by jollybv »

Hi Ben

What i was referring to in the video is the way he clears the whole screen using Sprits to stop the the flickering. I have tried using the clear screen but that is really slow so now I'm clearing every line individual and that a lot of code but don't get the flickering and its quick.

BenR
Matrix Staff
Posts: 1707
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 435 times
Been thanked: 598 times

Re: ili9341 various macros

Post by BenR »

I'll have a proper watch of the video and see if there's anything we can learn and apply to our libraries.

Doing a full screen write in one go would certainly reduce flicker and code complexity but would also require a lot of ram and so wouldn't work for a lot of MCU targets.

320 x 240 pixels * 16-bit colour = a RAM buffer of 150KB

For MCU devices that can support this it would be a great addition. I'll have a think of a nice way to try and do this maybe a display buffer component with routines to draw the full screen and then send to the display all in one go.

It might be possible to double buffer the display hardware as that would provide a very simple means to acheive full screen redraws. I'll check if the ILI displays can allow this.

edit, it looks like people have tried and the ILI9341 cannot do double buffering itself without sacrificing half of the screen.
https://www.reddit.com/r/arduino/commen ... i9341_tft/

Post Reply