1824 views|2 replies

1452

Posts

1

Resources
The OP
 

[ESK32-360 Review] + TFT screen display function and expansion (2) [Copy link]

 

2. Extension of drawing functions

To implement the drawing function, first add the point drawing function, then add the line drawing function and the area filling function.

The added point drawing function is:

void LCD_dotDraw(u16 X_Location, u16 Y_Location, u16 Color)
{
    LCD_StarterSet(X_Location, Y_Location);
 LCD_WriteRAMPrior();
 LCD_WriteRAM(Color);
}

The added line drawing function is:

void LCD_DrawLine(u16 x1, u16 y1, u16 x2, u16 y2, u16 Color)
{
 u16 t;
 s16 xerr=0,yerr=0,delta_x,delta_y,distance;
 u16 incx,incy,uRow,uCol;
 delta_x=x2-x1;
 delta_y=y2-y1;
 uRow=x1;
 uCol=y1;
 if(delta_x>0)incx=1;
 else if(delta_x==0)incx=0;
 else { incx=-1; delta_x=-delta_x; }

 if(delta_y>0)incy=1;
 else if(delta_y==0)incy=0;
 else { incy=-1; delta_y=-delta_y; }

 if( delta_x>delta_y) distance=delta_x;
 else distance=delta_y;

 for(t=0;t<=distance+1;t++)
 {
 LCD_dotDraw(uRow,uCol,Color);
 xerr+=delta_x ;
 yerr+=delta_y ;
 if(xerr>distance)
 {
 xerr-=distance;
 uRow+=incx;
 }
 if(yerr>distance)
 {
 yerr-=distance;
 uCol+=incy;
 }
 }
}

Added area filling function:

void LCD_fill(u16 x,u16 y,u16 Height,u16 Width,u16 Color)
{
 u16 i,j;

 for(j=0;j<Height;j++)
 {
LCD_StarterSet(x,y);
 LCD_WriteRAMPrior();
 for (i = Width; i > 0; i--)
 {
 LCD_WriteRAM(Color);
 }
x++;
 }
}

With these three functions, we can easily display the waveform of the data when performing A/D acquisition. See you later!

This post is from Domestic Chip Exchange

Latest reply

You can try to port littlevgl, it will be enough if it has some drawing functions   Details Published on 2020-8-7 09:55
 
 

310

Posts

5

Resources
2
 

You can try to port littlevgl, it will be enough if it has some drawing functions

This post is from Domestic Chip Exchange

Comments

I haven’t had much contact with it before, I’ll learn more about it later.  Details Published on 2020-8-7 16:08
 
 
 

1452

Posts

1

Resources
3
 
Song Yuanhao posted on 2020-8-7 09:55 You can try to port littlevgl. It is enough to have some drawing functions

I haven’t had much contact with it before, I’ll learn more about it later.

This post is from Domestic Chip Exchange
 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list