-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
69 lines (60 loc) · 1.19 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include <reg52.h>
#include "gui.h"
#include "touch.h"
#include "calTimeDisplay.h"
#include "clock.h"
#include "AD.H"
#include "paintTFT.h"
#include "gy521.h"
#ifndef uchar
#define uchar unsigned char
#endif
#ifndef uint
#define uint unsigned int
#endif
uchar TimeArray[]={0, 0, 0, 0, 0, 0};
uchar i=0;
long x=0, y=0;
void main()
{
bit backTag = 1; //从其他界面返回主界面标志
P3 = 0x00;
initMPU();
TFT_Init(); //初始化触摸屏显示
TFT_ClearScreen(0x0000); //清屏,消除屏幕之前显示内容的影响
initTimer(); //初始化定时器0(时钟�
tempchange(); //初始化温度
while(1)
{
if( clockTag == 2 ) //闹钟响起
{
displayPageClock();
backTag = 1;
}
TFT_paintMainClock(backTag); // 显示时间
tempchange();
displayTemp(getTemp(),backTag); // 显示温度
backTag = 0;
if(TOUCH_XPT_ReadXY() == 1)
{
x=xpt_xy.x;
x=(x-304)*175/3422;
y=xpt_xy.y;
y=(y-256)*219/3440;
if(x>174)
{
x=174;
}
if(y>218)
{
y=218;
}
if( (x>115)&&(y<24) )
{
displayPageSetting(); //进入设置界面
TFT_ClearScreen(0x0000); //清屏
backTag = 1;
}
}
}
}