📄 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 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++;
}
}
DelaymS(5*1000);
}
int main (void)
{ // add user source code
PINSEL0 = 0x00000000;
PINSEL1 = 0x00000000;
GUI_Initialize();
while(1)
{ // 屏幕填充RGB色
DispRGB();
// 显示图片
DispPic();
}
return 0;
}
/*********************************************************************************************************
** End Of File
********************************************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -