}
//ÇåÆÁº¯Êý
//Color:ÒªÇåÆÁµÄÌî³äÉ«
void LCD_Clear(unsigned short int color)
{
unsigned short int i,j;
LCD_set_windows(0,0,lcddev.width-1,lcddev.height-1);
for(i=0;i for (j=0;j LCD_wt16bitData(color); } } } /********************************************************** * º¯Êý¹¦ÄÜ ---> LCD»µãº¯Êý * Èë¿Ú²ÎÊý ---> (x,y)¹â±ê×ø±êÊýÖµ * ·µ»ØÊýÖµ ---> none * ¹¦ÄÜ˵Ã÷ ---> µãµÄÑÕÉ«ÔÚÇ°ÃæµÄ»±ÊÑÕÉ«ÉèÖà **********************************************************/ void LCD_DrawPoint(unsigned short int x,unsigned short int y) { LCD_set_windows(x,y,x,y); //É趨¹â±ê×ø±ê LCD_wtREG_DATA(LCD_wtgram,lcddev.brushcl); //дÈëµãµÄÑÕÉ«Öµ,¼´ÉèÖû±ÊµÄĬÈÏÑÕÉ« } /********************************************************** * º¯Êý¹¦ÄÜ ---> LCD»µãº¯Êý£¬ÑÕÉ«ÖµËæÉ趨дÈ루¿ìËÙ»µã£© * Èë¿Ú²ÎÊý ---> (x,y)¹â±ê×ø±êÊýÖµ * cl£ºÒªÐ´ÈëµÄÑÕÉ«Öµ * ·µ»ØÊýÖµ ---> none * ¹¦ÄÜ˵Ã÷ ---> none **********************************************************/ void LCD_DrawPoint_Color(unsigned short int x,unsigned short int y,unsigned short int cl) { LCD_set_windows(x,y,x,y); //É趨¹â±ê×ø±ê LCD_wtREG_DATA(LCD_wtgram,cl); //дÈëµãµÄÑÕÉ«Öµ,¼´ÉèÖû±ÊµÄĬÈÏÑÕÉ« } /********************************************************** * º¯Êý¹¦ÄÜ ---> LCD»Ïߺ¯Êý * Èë¿Ú²ÎÊý ---> (x1,y1)Æðµã×ø±êÊýÖµ * (x2,y2)ÖÕµã×ø±êÊýÖµ * cl-»±ÊÑÕÉ« * ·µ»ØÊýÖµ ---> none * ¹¦ÄÜ˵Ã÷ ---> **********************************************************/ void LCD_Draw_Line(unsigned short int x1,unsigned short int y1,unsigned short int x2,unsigned short int y2, unsigned short int cl) { unsigned short int t; int xerr=0,yerr=0,delta_x,delta_y,distance; int 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_DrawPoint_Color(uRow,uCol,cl);//»µã xerr+=delta_x ; yerr+=delta_y ; if(xerr>distance) { xerr-=distance; uRow+=incx; } if(yerr>distance) { yerr-=distance; uCol+=incy; } } } /********************************************************** * º¯Êý¹¦ÄÜ ---> LCDÖе㷨»Ô²º¯Êý * Èë¿Ú²ÎÊý ---> (x,y)Æð½Ç×ø±êÊýÖµ * r£ºÔ²°ë¾¶ * * ·µ»ØÊýÖµ ---> none * ¹¦ÄÜ˵Ã÷ ---> Ô²µÄÑÕÉ«ÔÚÇ°ÃæµÄ»±ÊÑÕÉ«ÉèÖà **********************************************************/ void LCD_Draw_Circle(unsigned short int x0,unsigned short int y0,unsigned char r , unsigned short int cl) { unsigned char x,y; //Öá·½Ïò±äÁ¿ float d; x = 0; y = r; d = 5.0/4 - r; //ÄæʱÕë»Ô² while(x <= y) { LCD_DrawPoint_Color(x0 + x,y0 + y,cl); //270¡ã LCD_DrawPoint_Color(x0 + x,y0 - y,cl); //90¡ã LCD_DrawPoint_Color(x0 - x,y0 + y,cl); LCD_DrawPoint_Color(x0 - x,y0 - y,cl); LCD_DrawPoint_Color(x0 + y,y0 + x,cl); //0¡ã LCD_DrawPoint_Color(x0 + y,y0 - x,cl); LCD_DrawPoint_Color(x0 - y,y0 + x,cl); //180¡ã LCD_DrawPoint_Color(x0 - y,y0 - x,cl); if(d < 0) //yÖáË¥¼õÂý { d += x * 2.0 + 3; } else //xÖáË¥¼õÂý { d += 2.0 * (x - y) + 5; y--; } x++; } } /********************************************************** * º¯Êý¹¦ÄÜ ---> LCD»¾ØÐκ¯Êý * Èë¿Ú²ÎÊý ---> (x1,y1)Æð½Ç×ø±êÊýÖµ * (x2,y2)¶Ô½Ç×ø±êÊýÖµ ,¾ØÐεĶԽÇ×ø±ê * cl-»±ÊÑÕÉ« * ·µ»ØÊýÖµ ---> none * ¹¦ÄÜ˵Ã÷ ---> ÏßµÄÑÕÉ«ÔÚÇ°ÃæµÄ»±ÊÑÕÉ«ÉèÖà **********************************************************/ void LCD_Draw_Quad(unsigned short int x1,unsigned short int y1,unsigned short int x2,unsigned short int y2 , unsigned short int cl) { LCD_Draw_Line(x1,y1,x2,y1,cl); //ÒÔy1ΪÖá»Ïß LCD_Draw_Line(x2,y1,x2,y2,cl); //ÒÔx2ΪÖá»Ïß LCD_Draw_Line(x2,y2,x1,y2,cl); //ÒÔy2ΪÖá»Ïß LCD_Draw_Line(x1,y2,x1,y1,cl); //ÒÔx1ΪÖá»Ïß } /********************************************************** * º¯Êý¹¦ÄÜ ---> LCDÖ¸¶¨ÇøÓòÌî³äÑÕÉ«º¯Êý * Èë¿Ú²ÎÊý ---> (x1,y1)Æð½Ç×ø±êÊýÖµ * (x2,y2)¶Ô½Ç×ø±êÊýÖµ * cl£ºÌî³äÑÕÉ«Öµ * ·µ»ØÊýÖµ ---> none * ¹¦ÄÜ˵Ã÷ ---> ÔÚÆÁÄ»Éϻһ¸öËıßÐβ¢Ìî³äÏàÓ¦µÄÑÕÉ« * ¿éÇøÓò´óС£¨Ãæ»ý£© = (x2 - x1) * (y2 - y1) **********************************************************/ void LCD_Area_Color(unsigned short int x1,unsigned short int y1,unsigned short int x2,unsigned short int y2,unsigned short int cl) { unsigned short int i,j; LCD_set_windows(x1,y1,x2,y2); //ÉèÖùâ±êλÖà for(i=y1;i<=y2;i++) { for(j=x1;j<=x2;j++) LCD_wt16bitData(cl);//ÉèÖùâ±êλÖà } } /********************************************************** * º¯Êý¹¦ÄÜ ---> LCDÖ¸¶¨Î»ÖÃÏÔʾһ¸ö×Ö·ûº¯Êý * Èë¿Ú²ÎÊý ---> (x,y)×ø±êÊýÖµ * ch£ºÒªÏÔʾµÄ×Ö·û * size£º×ÖÌå´óС * mode£º0£º·Çµþ¼Ó·½Ê½ÏÔʾ¡£1£ºµþ¼Ó·½Ê½ÏÔʾ * ·µ»ØÊýÖµ ---> none * ¹¦ÄÜ˵Ã÷ ---> Ö÷ÒªÏÔʾһЩÐèÒª±ä»¯Ö®ÀàµÄÊý×ÖÏÔʾ **********************************************************/ void LCD_ShowChar(unsigned short int x,unsigned short int y,unsigned char ch,unsigned char csize,unsigned char mode) { unsigned char temp,t1,t; unsigned short int y0=y; unsigned char sz=(csize/8+((csize%8)?1:0))*(csize/2); //µÃµ½×ÖÌåÒ»¸ö×Ö·û¶ÔÓ¦µãÕó¼¯ËùÕ¼µÄ×Ö½ÚÊý ch=ch-' ';//µÃµ½Æ«ÒƺóµÄÖµ£¨ASCII×Ö¿âÊÇ´Ó¿Õ¸ñ¿ªÊ¼È¡Ä££¬ËùÒÔ-' '¾ÍÊǶÔÓ¦×Ö·ûµÄ×ֿ⣩ for(t=0;t if(csize==12)temp=ascii_1206[ch][t]; //µ÷ÓÃ1206×ÖÌå else if(csize==16)temp=ascii_1608[ch][t]; //µ÷ÓÃ1608×ÖÌå else if(csize==24)temp=ascii_2412[ch][t]; //µ÷ÓÃ2412×ÖÌå else return; //ûÓеÄ×Ö¿â for(t1=0;t1<8;t1++) { if(temp&0x80) { LCD_DrawPoint_Color(x,y,lcddev.cur_brushcl); } else if(mode==0) { LCD_DrawPoint_Color(x,y,lcddev.cur_backcl); } temp<<=1; y++; if(y>=lcddev.height)return; //³¬ÇøÓòÁË
上一篇:LDC1000在STM32的程序 LDC1000的STM32驱动源程序
下一篇:STM32F072标准库spi操作细节
推荐阅读最新更新时间:2024-11-13 17:20
设计资源 培训 开发板 精华推荐
- DC1562B-D,LTC6992-2 演示板,10 kHz,5% 至 95% 占空比 PWM
- LTC3265IFE 低噪声 ±15V 输出的典型应用电路来自单个 12V 输入
- 使用 Analog Devices 的 LT1585CT-3.45 的参考设计
- LTC2992IDE-1 -48V 冗余馈电的典型应用,具有高达 200V 的瞬态保护(1.5kHz I2C 接口)
- 用于数据采集系统的 5V 模拟放大
- Ai-Thinker VC离线语音控制
- REF196 精密微功率、低压差堆叠电压基准的典型应用电路
- 【RA】OLED小时钟+1500720A
- LTC1798CS8-4.1 电压基准作为电源分配器的典型应用电路
- AM1S-4818SH30Z 1W DC-DC转换器典型应用