我参考 http://www.openedv.com/posts/list/34672.htm 的“源码”,实现了128*64液晶显示,目前菜单也可以切换显示,但是我不理解 菜单列表 具体是怎么跳转的,望高手指点。
菜单切换部分过程: 按down后 由*fun1→*fun2, 再按down后*fun2→*fun3,再按down后*fun3→*fun3,再按up后*fun3→*fun2,再按up后*fun2→*fun1,再按up后*fun1→*fun1, 再按enter后*fun1→*fun4,再按num_ent或者up都是*fun4不变。现在不想这样试下去,谁能解释一下菜单列表 具体是怎么跳转的????
[mw_shl_code=c,true]#include "led.h"
#include "delay.h"
#include "sys.h"
#include "usart.h"
#include "lcd.h"
//#include "usmart.h"
#include "rtc.h"
#include "fun.h"
#include "key.h"
#include "stm32f10x_encoder.h"
#include "stm32f10x.h"
#include"stm32f10x_conf.h"
////ALIENTEK Mini STM32??·?°?·????ú??13
////RTC???±?±?????é
////?????§????www.openedv.com
////?????????í??×?????????????
u8 func_index=0;
void (*current_operation_index)(); //?????±?°????????
typedef struct
{
u8 current; //?±?°×?????
u8 up;//?ò??·??÷????
u8 down;//?ò??·??÷????
u8 enter;//?·???÷????
u8 num_ent;//±à???÷?·???ü
void (*current_operation)(); //????????????
} key_table;
key_table table[32]=
{
[/mw_shl_code]
[mw_shl_code=c,true] {0,0,1,3,0,(*fun1)},
{1,0,2,7,1,(*fun2)}, //??????????±í
{2,1,2,11,2,(*fun3)},
{3,3,4,0,3,(*fun4)},
{4,3,5,0,4,(*fun5)},
{5,4,6,0,5,(*fun6)},
{6,5,6,0,6,(*fun7)},
{7,7,8,15,7,(*fun8)},
{8,7,9,19,8,(*fun9)},
{9,8,10,23,9,(*fun10)},
{10,9,10,1,10,(*fun11)},
{11,11,12,28,11,(*fun12)},
{12,11,13,31,12,(*fun13)},
{13,12,14,13,13,(*fun14)},
{14,13,14,2,14,(*fun15)},
{15,15,16,15,25,(*fun16)},
{16,15,17,16,25,(*fun17)},
{17,16,18,17,25,(*fun18)},
{18,17,18,7,18,(*fun19)},
{19,19,20,19,26,(*fun20)},
{20,19,21,20,26,(*fun21)},
{21,20,22,21,26,(*fun22)},
{22,21,22,8,22,(*fun23)},
{23,23,24,23,27,(*fun24)},
{24,23,24,9,24,(*fun25)},
{25,7,7,7,7,(*fun26)},
{26,8,8,8,8,(*fun27)},
{27,9,9,9,9,(*fun28)},
{28,28,29,30,28,(*fun29)},
{29,28,29,30,29,(*fun30)},
{30,11,11,11,11,(*fun31)},
{31,12,12,12,12,(*fun32)}
};
int main(void)
{
u8 num;
delay_init(); //???±????????
LED_Init(); //????????LED??????????????
InitLCD();
while(1)
{
num = KEY_Scan();//?????ü??
switch(num)
{
case 1:
ClearScreen();
func_index=table[func_index].up;
LED0=!LED0;
break; //?ò??·? S6
case 2:
ClearScreen();
func_index=table[func_index].down;
LED1=!LED1;
break; //?ò??·? S7
case 3:
ClearScreen();
func_index=table[func_index].enter;
LED2=!LED2;
break; //?·?? S5
case 4:
ClearScreen();
func_index=table[func_index].num_ent;
LED3=!LED3; // S8
break;
default:
delay_ms(10);
}
current_operation_index=table[func_index].current_operation;
(*current_operation_index)();
}
}
[/mw_shl_code]
|