📄 main.c
字号:
/****************************************Copyright (c)**************************************************
** Guangzou ZLG-MCU Development Co.,LTD.
** graduate school
** http://www.zlgmcu.com
**
**--------------File Info-------------------------------------------------------------------------------
** File name: main.c
** Last modified Date: 2004-09-16
** Last Version: 1.0
** Descriptions: The main() function example template
**
**------------------------------------------------------------------------------------------------------
** Created by: Chenmingji
** Created date: 2004-09-16
** Version: 1.0
** Descriptions: The original version
**
**------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
** Version:
** Descriptions:
**
********************************************************************************************************/
#include "config.h"
extern uint8 gImage_pic1[];
extern uint8 menuchar1[];
extern uint8 wel[];
#define LEDCON 1<<28
extern void DelaymS(uint32 no);
/*******************************************************
* 名称: DispRGB
* 功能: 显示RGB红色。第种纯色,各占80行。
* 入口参数: 无
* 出口参数: 无
*******************************************************/
void DispRGB(void)
{ uint32 x,y;
TftSetWindow(0,0, 239,319);
TftSetWrite(0, 0);
// 填充红色
for(y=0; y<80; y++)
{ for(x=0; x<240; x++)
{ TftSendDat(0xF800);
}
}
// 填充绿色
for(y=0; y<80; y++)
{ for(x=0; x<240; x++)
{ TftSendDat(0x07E0);
}
}
// 填充蓝色
for(y=0; y<80; y++)
{ for(x=0; x<240; x++)
{ TftSendDat(0x001F);
}
}
// 填充白色
for(y=0; y<80; y++)
{ for(x=0; x<240; x++)
{ TftSendDat(0xFFFF);
}
}
DelaymS(5*1000); // 延时5S
}
/*******************************************************
* 名称: DispPic
* 功能: 显示图形演示。
* 入口参数: 无
* 出口参数: 无
*******************************************************/
void DispPic(void)
{ uint32 x, y;
uint32 no;
uint16 dat;
// 第1幅图
TftSetWindow(0,0, 239, 319);
TftSetWrite(0,0);
no = 0;
/* for(y=0; y<320; y++)
{ for(x=0; x<240; x++)
{ dat = (gImage_pic1[no+1]<<8) | gImage_pic1[no];
TftSendDat(dat);
no++;
no++;
}
}*/
for(y=0; y<32; y++)
{ for(x=0; x<32; x++)
{ dat = (gImage_pic1[no+1]<<8) | gImage_pic1[no];
// TftSendDat(dat);
GUI_Point(x,y,dat);
no++;
no++;
}
}
DelaymS(5*1000);
}
/*******************************************************
* 名称: DispWel
* 功能: 显示欢迎界面。
* 入口参数: 无
* 出口参数: 无
*******************************************************/
void DispWel(void)
{ uint32 x, y;
// int i;
// uint32 no;
// uint16 dat;
// 第1幅图
TftSetWindow(0,0, 239, 319);
TftSetWrite(0,0);
/* for(x=0;x<240;x++)
{
for(y=0;y<32;y++)
{
GUI_Point(x,y,0xFFE0);
}
if((x+1)%24==0)x+=24;
y-=32;
}*/
// GUI_PutString24_32(48,64,"15465");
// GUI_PutChar24_32(48,64,' ');
GUI_PutChar1(180,180);
// GUI_PutString8_8(48,192,"Welcom !");
/* for(x=0;x<240;x++)
{
for(y=128;y<160;y++)
{
GUI_Point(x,y,RED);
}
if((x+1)%24==0)x+=24;
y-=32;
}
*/
/* no = 0;
for(y=0; y<4; y++)
{ for(x=0; x<4; x++)
{ dat = (wel[no+1]<<8) | wel[no];
TftSendDat(dat);
no++;
no++;
}
}*/
/* for(y=0; y<80; y++)
{ for(x=0; x<120; x++)
{ GUI_Point(x,y,0x8F);
}
}*/
/* for(y=80;y<=90;y++)
{
for(x=80;x<=120;x++)
{ GUI_Point(x,y,0x8F);
}
}
for(y=100;y<=110;y++)
{
for(x=60;x<=140;x++)
{ GUI_Point(x,y,0x8F);
}
}*/
/* for(i=0; i<63; i+=12)
{
GUI_PutString8_8(i,i, "Hello ZLG/GUI!"); // 指定位置显示字符串
}*/
/* i=GUI_PutChar24_32(0,0,"9");
GUI_PutString24_32(40,40,"45126");
if(i==1){IO0CLR=LEDCON;DelaymS(1000);IO0SET=LEDCON;}*/
DelaymS(3*1000);
}
int main (void)
{ // add user source code
PINSEL0 = 0x00000000;
PINSEL1 = 0x00000000;
IO0DIR=LEDCON;
IO0SET=LEDCON;
GUI_Initialize();
while(1)
{ //显示欢迎界面
DispWel();
// 屏幕填充RGB色
// DispRGB();
// 显示图片
// DispPic();
}
return 0;
}
/*********************************************************************************************************
** End Of File
********************************************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -