-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMenuAPP.cpp
More file actions
131 lines (102 loc) · 3.93 KB
/
Copy pathMenuAPP.cpp
File metadata and controls
131 lines (102 loc) · 3.93 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#include "MenuAPP.h"
void mainPageCallBack(u8 key);
void mainPage_Item1_CallBack(u8 key);
extern const struct PAGE Version_Page;
void Version_CallBack(u8 key);
extern const struct PAGE Setting_Page;
void Setting_CallBack(u8 key);
extern const struct PAGE Time_Page;
void Time_CallBack(u8 key);
/******************************************************************************************************/
//主菜单
//定义Item项 //显示方式&序号 项目的名字 项目指向的页(Page)
const struct Item main_item[]={ (u8*)"memu0", 0,
(u8*)"Set", &Setting_Page,
(u8*)"Version", &Version_Page,
(u8*)"Time", &Time_Page,
(u8*)"memu4", 0,
(u8*)"memu5", 0,
(u8*)"memu6", 0,
(u8*)"memu7", 0
};
//定义一个Page 父页 该页的回调函数 该页的项 项的个数
const struct PAGE mainPage={0,mainPageCallBack,main_item,sizeof(main_item)/sizeof(struct Item),DISPLAY_MODE_2_COLUMN};
/*********************************************************************************************************/
const struct PAGE Version_Page={&mainPage,Version_CallBack,0,0,DISPLAY_MODE_0_COLUMN};
/***************************************************************************************************************/
//定义Item项 //显示方式&序号 项目的名字 项目指向的页(Page)
const struct Item Setting_item[]={ (u8*)" 00.set0", 0,
(u8*)" 01.set1", 0,
(u8*)" 02.set2", 0,
(u8*)" 03.set3", 0,
(u8*)" 04.set4", 0,
(u8*)" 05.set5", 0,
(u8*)" 06.set6 hell world", 0,
(u8*)" 07.set7", 0,
(u8*)" 08.set8", 0,
(u8*)" 09.set9", 0,
(u8*)" 10.set10", 0
};
const struct PAGE Setting_Page={&mainPage,Setting_CallBack,Setting_item,sizeof(Setting_item)/sizeof(struct Item),DISPLAY_MODE_1_COLUMN};
/***************************************************************************************************************/
const struct PAGE Time_Page={&mainPage,Time_CallBack,0,0,DISPLAY_MODE_0_COLUMN};
/**
主菜单回调函数,对这个页得处理全部放在回调函数里
@param key 按键代码
*/
void mainPageCallBack(u8 key)
{
switch (key)
{
case KEY_UP:
case KEY_Down:
case KEY_Left:
case KEY_Right:
KeySelItem(key);
break;
case KEY_Return:///<主菜单 对返回按键没有处理
ShowPage(&mainPage);
break;
case KEY_Ok:
ShowItemPage();
break;
}
}
void Version_CallBack(u8 key)
{
LCD_Write_Str(0,0,(u8*)" Info ");
LCD_Write_Str(1,0,(u8*)"Co:www.80eboy.com");
LCD_Write_Str(2,0,(u8*)"Addr:ShenZhen");
LCD_Write_Str(3,0,(u8*)"Version:V1.0");
if (key==KEY_Return)
{
ShowParentPage();
}
}
void Setting_CallBack(u8 key)
{
switch (key)
{
case KEY_UP:
case KEY_Down:
case KEY_Left:
case KEY_Right:
KeySelItem(key);
break;
case KEY_Return:///<主菜单 对返回按键没有处理
ShowParentPage();
break;
case KEY_Ok:
ShowItemPage();
break;
}
}
void Time_CallBack(u8 key)
{
LCD_Write_Str(0,0,(u8*)"Date:2012-7-5");
LCD_Write_Str(1,0,(u8*)"Time:16:59");
if (key==KEY_Return)
{
ShowParentPage();
}
}